Bug #74679 [Opn]: Incorrect conversion of array

From: Date: Wed, 31 May 2017 13:48:54 +0000
Subject: Bug #74679 [Opn]: Incorrect conversion of array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209321@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74679&edit=1 ID: 74679 User updated by: wapinet at mail dot ru Reported by: wapinet at mail dot ru Summary: Incorrect conversion of array Status: Open Type: Bug Package: SOAP related Operating System: any PHP Version: 7.1.5 Block user comment: N Private report: N New Comment: 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( 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 Previous Comments: ------------------------------------------------------------------------ [2017-05-31 12:58:53] wapinet at mail dot ru 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 this bug report at https://bugs.php.net/bug.php?id=74679&edit=1

« previous php.bugs (#209321) next »