Edit report at https://bugs.php.net/bug.php?id=64101&edit=1
ID: 64101 Comment by: 2013 at birth-online dot de Reported by: jeffdafoe at gmail dot com Summary: SoapClient weirdness when passed undefined connection_timeout Status: Open Type: Bug Package: SOAP related Operating System: CentOS linux, Debian stable PHP Version: 5.3.21 Block user comment: N Private report: N New Comment: Here's an old bug report from the Ubuntu bugtracker from May 2012 and today we stumbled upon this bug again using PHP 5.3.10-1ubuntu3.6 (latest version for Ubuntu 12.04LTS): EXAMPLE CODE ------------ <?php $header = array(); $header["header_general"]["order_type"] = "SHOP"; print_r( $header ); #$timeout = 1; $client = new SoapClient( null, array( 'location' => 'www.silversolutions.de', 'uri' => 'www.silversolutions.de', 'connection_timeout' => $timeout ) ); $header = array(); $header["header_general"]["order_type"] = "SHOP"; print_r( $header ); ?> COMMAND ------- php -n test.php (NO CONFIG IS USED!!) ACTUAL OUTPUT ------------- Array ( [header_general] => Array ( [order_type] => SHOP ) ) Warning: Cannot use a scalar value as an array in /home/mab/test.php on line 11 Array ( [header_general] => 0 ) EXPECTED OUTPUT --------------- Array ( [header_general] => Array ( [order_type] => SHOP ) ) Array ( [header_general] => Array ( [order_type] => SHOP ) ) This is on Linux johndoe 3.2.0-24-virtual #37-Ubuntu SMP Wed Apr 25 10:17:19 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux. and Linux johndoe 3.2.0-38-virtual #61-Ubuntu SMP Tue Feb 19 12:37:47 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux On a desktop machine with Linux johndoe 3.2.0-24-generic #38-Ubuntu SMP Tue May 1 16:18:50 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux it works as expected. Previous Comments: ------------------------------------------------------------------------ [2013-01-29 21:00:24] jeffdafoe at gmail dot com Description: ------------ When SoapClient is passed an undefined variable in the connection_timeout hash key, it seems that all global variables are initialized to 0. I can reproduce this on multiple linux distributions and PHP versions. I can also repro it using any WSDL. It only happens when connection_timeout is set to an uninitialized variable, I am not able to reproduce it in any other case. I discovered it by accident but figured I'd report it due to the unusual and seemingly wide impact of the resultant behavior. Test script: --------------- $myi = null; print 'Before: myi->foo=' . $myi->foo . ' fakevar=' . $fakevar . ' fakeobj->prop=' . $fakeobj->prop . "\n"; $url = 'http://soap.amazon.com/schemas2/AmazonWebServices.wsdl'; $sc = new SoapClient($url, array( 'connection_timeout'=>$foo ) ); print 'After: myi->foo=' . $myi->foo . ' fakevar=' . $fakevar . ' fakeobj->prop=' . $fakeobj->prop . "\n"; Expected result: ---------------- myi->foo= fakevar= fakeobj->prop= Actual result: -------------- myi->foo=0 fakevar=0 fakeobj->prop=0 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64101&edit=1