php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74679 Incorrect conversion array with WSDL_CACHE_MEMORY
Submitted: 2017-05-31 12:58 UTC Modified: 2017-06-13 09:51 UTC
From: wapinet at mail dot ru Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 7.1.5 OS: any
Private report: No CVE-ID: None
 [2017-05-31 12:58 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-31 13:48 UTC] 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(
                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
 [2017-05-31 14:23 UTC] wapinet at mail dot ru
!!!
problem only if SoapServer configured with "'cache_wsdl' => WSDL_CACHE_MEMORY"
!!!
if "'cache_wsdl' => WSDL_CACHE_DISK" or none the problem is not reproduced (works correct).
 [2017-05-31 15:28 UTC] wapinet at mail dot ru
-Summary: Incorrect conversion of array +Summary: Incorrect conversion of array with WSDL_CACHE_MEMORY
 [2017-05-31 15:28 UTC] wapinet at mail dot ru
upd Summary
 [2017-05-31 15:28 UTC] wapinet at mail dot ru
-Summary: Incorrect conversion of array with WSDL_CACHE_MEMORY +Summary: Incorrect conversion array with WSDL_CACHE_MEMORY
 [2017-05-31 15:28 UTC] wapinet at mail dot ru
ups summary 2
 [2017-06-13 09:50 UTC] dmitry@php.net
please provide the whole WSDL file
 [2017-06-13 09:51 UTC] dmitry@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: dmitry
 [2017-06-13 11:12 UTC] wapinet at mail dot ru
@dmitry,
https://gist.github.com/Gemorroj/350dd553888cc0c74cbaf77eb680770c
 [2017-06-13 14:17 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=648be8600ff89e1b0e4a4ad25cebad42b53bed6d
Log: Fixed bug #74679 (Incorrect conversion array with WSDL_CACHE_MEMORY)
 [2017-06-13 14:17 UTC] dmitry@php.net
-Status: Feedback +Status: Closed
 [2017-06-13 14:18 UTC] dmitry@php.net
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=648be8600ff89e1b0e4a4ad25cebad42b53bed6d
Log: Fixed bug #74679 (Incorrect conversion array with WSDL_CACHE_MEMORY)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 05:01:27 2024 UTC