Re: Odd Behavior PHP v4.2.3 to v4.3.1

From: Date: Wed, 07 May 2003 22:28:28 +0000
Subject: Re: Odd Behavior PHP v4.2.3 to v4.3.1
References: 1  Groups: php.soap 
Request: Send a blank email to php-soap+get-585@lists.php.net to get a copy of this message
We replaced v4.3.1 with v4.2.3 on the second machine and everything now runs. So it looks like a PHP problem with some part of this code. We have run genproxy.php from the command line on both versions and had no problem with it generating the code, so I'd expect that it is a problem with PHP generating the class from eval(). But that's just a guess. Rob "Rob Booth" <rbooth@indyme.com> wrote in message news:20030507221112.77144.qmail@pb1.pair.com... > I have two machines each running Apache 1.3.x and PHP, one of them is using > v4.2.3 and the other v4.3.1. They both have the same PEAR::SOAP version on > them. > > When I run the below code on machine 1 (v4.2.3) everything is fine, but when > I run it on machine 2 I get this error: > > Fatal error: Call to undefined function: identify() > in /home/rmitchell/CVS/IWS/WebServices/Services/services.php on line 20 > > I'm wondering if anyone else has ever run into something like this before. > The service that they are calling is the same code on both machines. > > Any help is greatly appreciated. > > Rob > > Here is the code that is running, all it does is navigate the current > directory structure looking for services in the directories that it finds. > > <?php > require_once('webservice.php'); > > $services = array(); > $dh = opendir('.'); > > while (($file = readdir($dh)) !== false) { > if ($file != '.' && $file != '..') { > if (is_dir($file)) { > $url = 'http://' . > $_SERVER['SERVER_NAME'] > . substr($_SERVER['REQUEST_URI'], 0, > strrpos($_SERVER['REQUEST_URI'], '/') ) > . '/' . $file . '/'; > > if (($client = WebService::ServiceProxy($url . '?wsdl')) > != false) { > > if (is_object($client)) { > $name = $client->Identify(); > $services[] = array('Name' => $name, > 'URL' => $url . 'index.php'); > } > } > } > } > } > > print_r($services); > ?> > > And here is webservice.php: > > <?php > /* webservice.php > * > * Based on Active States SWSAPI for PHP described at > * http://aspn.activestate.com/ASPN/WebServices/SWSAPI/ > * > * Can use both the PEAR::SOAP librara > * (available via CVS at pear.php.net) and the > * NuSOAP library (http://dietrich.ganx4.com/nusoap/) > */ > > // All PHP errors except notices > error_reporting(E_ALL ^ E_NOTICES); > > // Edit this constant depending on your implementation: > // 'PEAR::SOAP' for PEAR::SOAP and 'NuSOAP' for NuSOAP > define('SOAP_IMP', 'PEAR::SOAP'); > > if (SOAP_IMP=='NuSOAP') { > // Modify this line to the location of this file > require_once('nusoap.php'); > } else if (SOAP_IMP=='PEAR::SOAP') { > require_once('SOAP/Client.php'); > } else { > die ('Constant SOAP_IMP not defined or not recognized'); > } > > // function to get constructor of a class specification > function getConstructor($class) { > preg_match("/^class (.*) extends/", $class, $matches); > return $matches[1]; > } > > class WebService { > /** > * ServiceProxy > * parses the wsdl and returns a new > * instance of a class for that wsdl. > */ > function &ServiceProxy($wsdl) { > if (SOAP_IMP=='NuSOAP') { > $soapClient = new soapclient($wsdl, 'wsdl'); > $soapProxy = $soapclient->getProxy(); > return $soapProxy; > } else if (SOAP_IMP=='PEAR::SOAP') { > if (extension_loaded('overload')) { > // overload is available with PHP 4.2 > return new SOAP_Client($wsdl,1); > } else { > // PHP 4.1.x will use this section of code > $wsdlProxy = new SOAP_WSDL($wsdl); > if ($wsdlProxy->fault) { > // echo $wsdlProxy->fault->toString(); > return NULL; > } > $class = $wsdlProxy->generateProxyCode(); > eval($class); > $name = getConstructor($class); > return new $name; > } > } > } > } > ?> > > >

« previous php.soap (#585) next »