Bug #74679 [NEW]: Incorrect conversion of array

From: Date: Wed, 31 May 2017 12:59:00 +0000
Subject: Bug #74679 [NEW]: Incorrect conversion of array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209319@lists.php.net to get a copy of this message
From: wapinet at mail dot ru Operating system: any PHP version: 7.1.5 Package: SOAP related Bug Type: Bug Bug description:Incorrect conversion of array Description: ------------ php code: $server = new SoapServer('my.wsdl'); $server->setClass(Api::class); $server->handle(); class Api { public function receiveEDIMessages() { return array( 'head' => null, 'body' => array( 'message' => 'text', 'from' => '2352457999993', 'to' => '2352456999994', 'id' => 54370 ), ); } } WSDL (use rpc style): <xsd:complexType name="bodyMessagesResponse"> <xsd:complexContent> <xsd:restriction base="soapenc:Array"> <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="tns:messageResponse[]"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="messageResponse"> <xsd:sequence> <xsd:element name="message" type="xsd:string"/> <xsd:element name="from" type="xsd:string"/> <xsd:element name="to" type="xsd:string"/> <xsd:element name="id" type="xsd:integer"/> </xsd:sequence> </xsd:complexType> response php 5.6: <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http_://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http_://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:interface" xmlns:xsd="http_://www.w3.org/2001/XMLSchema" xmlns:xsi="http_://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:private" xmlns:SOAP-ENC="http_://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:receiveEDIMessagesResponse> <receiveEDIMessagesReturn xsi:type="ns2:receiveEDIMessagesResponse"> <head xsi:type="ns2:headResponse"> <code xsi:type="xsd:int">0</code> <message xsi:nil="true"/> </head> <body SOAP-ENC:arrayType="ns2:messageResponse[1]" xsi:type="ns2:bodyMessagesResponse"> <item xsi:type="ns2:messageResponse"> <message xsi:type="xsd:string">text</message> <from xsi:type="xsd:string">2352457999993</from> <to xsi:type="xsd:string">2352456999994</to> <id xsi:type="xsd:integer">54370</id> </item> </body> </receiveEDIMessagesReturn> </ns1:receiveEDIMessagesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> response php 7.x: <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http_://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http_://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:interface" xmlns:xsd="http_://www.w3.org/2001/XMLSchema" xmlns:xsi="http_://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="urn:private" xmlns:ns3="http_://xml.apache.org/xml-soap" xmlns:SOAP-ENC="http_://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:receiveEDIMessagesResponse> <receiveEDIMessagesReturn xsi:type="ns2:receiveEDIMessagesResponse"> <head xsi:type="ns2:headResponse"> <code xsi:type="xsd:int">0</code> <message xsi:nil="true"/> </head> <body SOAP-ENC:arrayType="ns3:Map[1]" xsi:type="ns2:bodyMessagesResponse"> <item xsi:type="ns3:Map"> <item> <key xsi:type="xsd:string">message</key> <value xsi:type="xsd:string">text</value> </item> <item> <key xsi:type="xsd:string">from</key> <value xsi:type="xsd:string">2352457999993</value> </item> <item> <key xsi:type="xsd:string">to</key> <value xsi:type="xsd:string">2352456999994</value> </item> <item> <key xsi:type="xsd:string">id</key> <value xsi:type="xsd:string">54370</value> </item> </item> </body> </receiveEDIMessagesReturn> </ns1:receiveEDIMessagesResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Expected result: ---------------- response php 5.6 is actual result -- Edit bug report at https://bugs.php.net/bug.php?id=74679&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74679&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74679&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74679&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74679&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74679&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74679&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74679&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74679&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74679&r=support Expected behavior: https://bugs.php.net/fix.php?id=74679&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74679&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74679&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74679&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74679&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74679&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74679&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74679&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74679&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74679&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74679&r=mysqlcfg

« previous php.bugs (#209319) next »