#46419 [NEW]: Elements of associative arrays and object properties with NULL value are lost

From: Date: Wed, 29 Oct 2008 12:47:18 +0000
Subject: #46419 [NEW]: Elements of associative arrays and object properties with NULL value are lost
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-130276@lists.php.net to get a copy of this message
From: max dot bilyk at gmail dot com Operating system: SuSE SLES 10 PHP version: 5.2.6 PHP Bug Type: SOAP related Bug description: Elements of associative arrays and object properties with NULL value are lost Description: ------------ When transferring via SOAP associative arrays which have elements with NULL value these elements are lost. At the same time f.e. empty strings are transferred normally. Properities of objects with NULL value are also transferred OK. The problem is that indices of associative arrays are also informative as well as their values, therefore it's a loss of significant information. Another example: in case of data fetch from database into associative array we often have array elements with NULL value, and when fetching multiple rows each time the structure of array will be different while we expect it to be the same after transfer via SOAP. P.S. This case is in non-WSDL mode. Reproduce code: --------------- ---- SOAP Server --- class foo { function bar() { return array('a' => 1, 'b' => NULL, 'c' => 2, 'd'=>''); } } $server = new SoapServer(null, array('uri' => "http://test-uri/")); $server->setClass("foo"); $server->handle(); ---- SOAP Client --- $client = new SoapClient(NULL, array('location'=> "http://...../server.php", "uri" => "http://test-uri/", "trace" => 1, "exceptions" => 1)); $result = $client->bar(); print_r($result); Expected result: ---------------- array ( 'a' => 1, 'b' => NULL 'c' => 2 'd' => '', ) Actual result: -------------- array ( 'a' => 1, 'c' => 2 'd' => '', ) -- Edit bug report at http://bugs.php.net/?id=46419&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46419&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46419&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46419&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46419&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46419&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=46419&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46419&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46419&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46419&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46419&r=support Expected behavior: http://bugs.php.net/fix.php?id=46419&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46419&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46419&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46419&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46419&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46419&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46419&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46419&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46419&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46419&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46419&r=mysqlcfg

« previous php.bugs (#130276) next »