php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37126 Invalid conversion from php string to xsd:long
Submitted: 2006-04-18 18:29 UTC Modified: 2006-04-26 01:00 UTC
Votes:6
Avg. Score:4.7 ± 0.5
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:5 (83.3%)
From: karthikm at yahoo-inc dot com Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.1.2 OS: Windows XP, Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: karthikm at yahoo-inc dot com
New email:
PHP Version: OS:

 

 [2006-04-18 18:29 UTC] karthikm at yahoo-inc dot com
Description:
------------
longs represented as php string variables do not get converted correctly to soap parameter declared as xsd:long. But, longs represented as php numbers work correctly. 

Ex:
$idValue = '572527773301459002' shows up incorrectly as
<ns1:ID>2147483647</ns1:ID>

where as,

$idValue = 572527773301459002 shows up correctly as
<ns1:ID>572527773301459010</ns1:ID>


Reproduce code:
---------------
<?php
$client = new SoapClient(
		"file:///C:/temp/phpbug/MyService.wsdl",
	array( 	"trace" => true,
			"exceptions" => true,
			"location" => "http://localhost:8144/MyService",
			"connection_timeout"=>10)
);
$idValue = '572527773301459002';
$obj = array(
	'ID' => $idValue,
	);
$retObj = $client->__soapCall(
		'operation',
		array( $obj )
	);
?>

=======MyService.wsdl=======
<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
	xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
	xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
	xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
	xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
	xmlns:tns="http://mycompany.com"
	xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://mycompany.com">
    <wsdl:types>
        <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://mycompany.com">
            <xsd:element name="operation">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="ID" type="xsd:long"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="operationResponse">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="operationResponse">
        <wsdl:part element="tns:operationResponse" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="operationRequest">
        <wsdl:part element="tns:operation" name="parameters"/>
    </wsdl:message>
    <wsdl:portType name="MyService">
        <wsdl:operation name="operation">
            <wsdl:input message="tns:operationRequest" name="operationRequest"/>
            <wsdl:output message="tns:operationResponse" name="operationResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="MyServiceHttpBinding" type="tns:MyService">
        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="operation">
            <wsdlsoap:operation soapAction=""/>
            <wsdl:input name="operationRequest">
                <wsdlsoap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="operationResponse">
                <wsdlsoap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="MyServiceService">
        <wsdl:port binding="tns:MyServiceHttpBinding" name="MyService">
            <wsdlsoap:address location="https://localhost/MyService"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
   <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://mycompany.com">
      <SOAP-ENV:Body>
         <ns1:operation>
            <ns1:ID>572527773301459010</ns1:ID>
         </ns1:operation>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
   <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://mycompany.com">
      <SOAP-ENV:Body>
         <ns1:operation>
            <ns1:ID>2147483647</ns1:ID>
         </ns1:operation>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-18 21:25 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-04-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-05-13 03:23 UTC] karthikm at yahoo dot com
Checked in all version upto 6.0 releases from http://snaps.php.net/ and with the php_soap.dlls gotten from http://pecl4win.php.net/ext.php/php_soap.dll. 

All versions seem to have the same issue.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC