Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.14.0

Request #13552 Improve memory usage when serializing arrays
Submitted: 2008-04-01 07:33 UTC
From: jasony Assigned:
Status: Open Package: SOAP (version 0.11.0)
PHP Version: 5.2.3 OS: Ubuntu Linux
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 46 + 4 = ?

 
 [2008-04-01 07:33 UTC] jasony (Jason Norwood-Young)
Description: ------------ When trying to create an array of integers on a Soap server, it bombs out if the array is over 12 elements. The error message is: Allowed memory size of 134217728 bytes exhausted (tried to allocate 44 bytes) in /usr/share/php/PEAR.php on line 868 Test script: --------------- soap_server_crash_test.php: <?php require_once('SOAP/Server.php'); require_once('SOAP/Disco.php'); class CrashTest { public $__dispatch_map = array(); public $__typedef=array(); public function __construct() { $this->__typedef['ArrayOfIntegers'] = array(array('item'=>'integer')); $this->__dispatch_map["crashMe"]=array("in"=>array("arraysize"=>"integer"),"out"=>array("artworks"=>"{urn:CrashTest}ArrayOfIntegers")); } public function crashMe($arraysize) { if ((empty($arraysize)) || (!is_numeric($arraysize))) { $fault=new SOAP_Fault("Invalid array size!"); return $fault; } $result=array(); for($x=0;$x<$arraysize;$x++) { $result[]=$x; } return $result; } } $server = new SOAP_Server(); $webservice=new CrashTest(); $server->addObjectMap($webservice,'http://schemas.xmlsoap.org/soap/envelope/'); if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD']=='POST') { $server->service($HTTP_RAW_POST_DATA); } else { $disco = new SOAP_DISCO_Server($server,'CrashTest'); header("Content-type: text/xml"); if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'],'wsdl') == 0) { // show only the WSDL/XML output if ?wsdl is set in the address bar echo $disco->getWSDL(); } else { echo $disco->getDISCO(); } } ?> Test client: <?php include_once("objects/soap.inc"); ini_set('soap.wsdl_cache_enabled', 0); $client=new SoapClient("http://localhost/dev/artvault_manager/soap_server_crash_test.php?wsdl",array('trace'=>1)); try { $result=$client->crashMe(12); } catch(SoapFault $exception) { $request_xml = $client->__getLastRequestHeaders() . $client->__getLastRequest(); $response_xml = $client->__getLastResponseHeaders() . $client->__getLastResponse(); echo $exception; print "Request:".$request_xml; print "Response:".$response_xml; } print_r($result); ?> Expected result: ---------------- Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5 [6] => 6 [7] => 7 [8] => 8 [9] => 9 [10] => 10 ) Actual result: -------------- SoapFault exception: [Client] looks like we got no XML document in /home/jason/Development/artvault_manager/soap_crash_test.php:6 Stack trace: #0 [internal function]: SoapClient->__call('crashMe', Array) #1 /home/jason/Development/artvault_manager/soap_crash_test.php(6): SoapClient->crashMe(12) #2 {main}Request:POST /dev/artvault_manager/soap_server_crash_test.php HTTP/1.1 Host: localhost Connection: Keep-Alive User-Agent: PHP-SOAP/5.2.3-1ubuntu6.3 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://schemas.xmlsoap.org/soap/envelope/#CrashTest#crashMe" Content-Length: 479 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:crashMe><arraysize xsi:type="xsd:integer">12</arraysize></SOAP-ENV:crashMe></SOAP-ENV:Body></SOAP-ENV:Envelope> Response:HTTP/1.1 200 OK Date: Tue, 01 Apr 2008 08:30:05 GMT Server: Apache/2.2.4 (Ubuntu) mod_python/3.3.1 Python/2.5.1 PHP/5.2.3-1ubuntu6.3 X-Powered-By: PHP/5.2.3-1ubuntu6.3 Content-Length: 165 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: text/html <br /> <b>Fatal error</b>: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in <b>/usr/share/php/PEAR.php</b> on line <b>868</b><br />

Comments

 [2008-04-18 10:04 UTC] jasony (Jason Norwood-Young)
*bump* Anyone looking at this? Can anyone even confirm it? J
 [2008-07-16 14:25 UTC] doconnor (Daniel O'Connor)
Dupe of Bug #14337
 [2008-07-16 14:32 UTC] yunosh (Jan Schneider)
No, this has nothing to do with hash limit.