ID: 43022 Updated by: [EMAIL PROTECTED] Reported By: sonya at look-for-it dot de -Status: Open +Status: Assigned Bug Type: SOAP related Operating System: Windows XP -PHP Version: 5.2.4 +PHP Version: 5.2CVS-2007-10-22 -Assigned To: +Assigned To: dmitry New Comment:
Assigned to the SOAP extension maintainer. Previous Comments: ------------------------------------------------------------------------ [2007-10-22 11:05:30] sonya at look-for-it dot de Thank you. I used the link you gave for windows (zip). But the objects passed by reference are still not saved in $GLOBALS. For the above example the object $TestClass1 is not saved in $GLOBALS['TestClass1'] when passed by reference and therefore it can not be access in TestClass2. global $TestClass1 <- this line doesn't point to the object unless I pass the object by value. ------------------------------------------------------------------------ [2007-10-22 10:39:51] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2007-10-19 08:27:37] sonya at look-for-it dot de I have just tested it on Apache/1.3.33 (Debian GNU/Linux) and PHP/5.2.3. Same behaviour. ------------------------------------------------------------------------ [2007-10-18 14:24:06] sonya at look-for-it dot de Description: ------------ I have problem with $GLOBALS while executing scripts via SOAP Service. Objects passed by reference is not set in $GLOBALS and cannot be used in other classes. The same code works perfectly if executed direct in browser. Reproduce code: --------------- client.php ---------------------------------------------- ini_set("soap.wsdl_cache_enabled", "0"); $client = new SoapClient("test.wsdl", array('trace'=> 1, 'exceptions' => 0)); print $client->testGlobals(); -------------------------------------------- server.php ---------------------------------------------- function testGlobals() { global $TestClass1, $TestClass2; require_once 'inc.php'; return $TestClass2->testvar2; } ini_set("soap.wsdl_cache_enabled", "0"); $server = new SoapServer("test.wsdl"); $server->addFunction("testGlobals"); $server->handle(); -------------------------------------------- inc.php -------------------------------------------- require_once('TestClass1.class.php'); require_once('TestClass2.class.php'); $TestClass2 = new TestClass2(); ------------------------------------------- TestClass1.class.php ------------------------------------------- class TestClass1 { public $testvar1; function TestClass1() { $this->testvar1 = 100; } } $TestClass1 = & new TestClass1(); --------------------------------------------- TestClass2.class.php --------------------------------------------- class TestClass2 { public $testvar2; function TestClass2() { global $TestClass1; $this->testvar2 = $TestClass1->testvar1; } } Expected result: ---------------- I expect the value 100 to be returned by service. Actual result: -------------- Nothing is returned. The reason is that in TestClass2 there is no $GLOBALS['TestClass1'] unless I pass $TestClass1 by value: (last line of TestClass1.class.php): $TestClass1 = new TestClass1(); What is wrong here? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43022&edit=1
