Protection when using getProxy

Help
2009-09-03
2013-06-06
  • Hi
    I've been confronted to a strange problem concerning the getProxy method in class nusoap_client.

    [code]
    $r = rand();
    $evalStr = $this->_getProxyClassCode($r);
    if ($e = $this->getError()) {
      return null;
    }
    eval($evalStr);
    eval("\$proxy = new nusoap_proxy_$r('');");
    [/code]

    It crashed at eval($evalStr); maybe because I had lot of nusoap calls at the same time, so the rand() would be the same (supposition..)

    I fixed this with this :
    [code]
    $r = rand();
    // check if the nusoap_proxy_$r class already exists
    if(!class_exists('nusoap_proxy_'.$r))
    {
      $evalStr = $this->_getProxyClassCode($r);
      if ($e = $this->getError()) {
        return null;
      }
      eval($evalStr);
    }
    eval("\$proxy = new nusoap_proxy_$r('');");
    [/code]

    Hope it could help anybody.
    Vincent

     

    Related

    Code: code