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

Bug #5004 Client: attachments array is not cleared properly
Submitted: 2005-08-05 09:31 UTC
From: laihro at gmx dot de Assigned: yunosh
Status: Closed Package: SOAP
PHP Version: 4.3.11 OS: Windows XP SP2
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 : 44 - 31 = ?

 
 [2005-08-05 09:31 UTC] laihro at gmx dot de
Description: ------------ In pear::soap 0.9.1 the SOAP_Base->__attachments Array is not properly cleared between two messages. The result is, that after receiving a message with attachments, parts of the attachment slip into the next message the client sends. This produces xml-errors like "content not allowed in prolog". Test script: --------------- [server] <?php $response = "------=_Part_13_18150163.1123064466959\nContent-Type: text/xml; charset=UTF-8\nContent-Transfer-Encoding: binary\nContent-Id: <E499622513F9AA87E77E75F8A2F73498>\n\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n<soapenv:Body>\n<ns1:getZippedCourseResponse soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:ns1=\"urn:WWRInterface\">\n<ns1:getZippedCourseReturn xsi:type=\"ns2:instance\" xmlns:ns2=\"WWREncoding\">\n<ns1:dataHandler href=\"cid:C8EFC5F183DA5492B74666A49D7603B4\" xmlns:ns3=\"http://xml.apache.org/xml-soap\"/>\n</ns1:getZippedCourseReturn>\n</ns1:getZippedCourseResponse>\n</soapenv:Body>\n</soapenv:Envelope>\n------=_Part_13_18150163.1123064466959\nContent-Type: text/xml\nContent-Transfer-Encoding: binary\nContent-Id: <C8EFC5F183DA5492B74666A49D7603B4>\n\nTEST\n------=_Part_13_18150163.1123064466959--\n"; header("Content-Type: multipart/related; type=\"text/xml\"; start=\"<E499622513F9AA87E77E75F8A2F73498>\"; boundary=\"----=_Part_13_18150163.1123064466959\""); print $response; ?> [client] <?php require_once 'SOAP/Client.php'; $client = new SOAP_Client("http://localhost/test/server.php"); $result = $client->call("attachTest", $param, array('trace' => 1)); $result = $client->call("attachTest", $param, array('trace' => 1)); print_r( $client->wire ); ?> Suggestion to patch this bug: Change in Client.php SOAP_Client->call() function &call($method, &$params, $namespace = false, $soapAction = false) { $this->headersIn = null; to function &call($method, &$params, $namespace = false, $soapAction = false){ $this->__attachments = array(); $this->headersIn = null; Expected result: ---------------- Client->wire: <?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" Actual result: -------------- Client->wire: http://schemas.xmlsoap.org/soap/envelope/<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

Comments

 [2006-01-06 18:05 UTC] yunosh
Have you tracked this further down? We actually reset the __attachments property by assigning it a value further down in call().
 [2006-01-11 10:19 UTC] laihro at gmx dot de
As I stated before the __attachments property slips into the next message a client sends, after the client received the message with the attachment. This behaviour can be easily repoduced with the test script. The error is produced by this call sequence: client->call server->response to client with an attachment client->call -> produces error The point is, that the error occurs when the client sends the next message. The new value for the __attachments property is not set until the client recieves a response to this message. To fix this, you have to initialize __attachments before $this->_soap_transport->send is called or find out, how the property slips into the message.
 [2007-01-21 18:47 UTC] yunosh (Jan Schneider)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.