php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30045 Cannot pass big integers (> 2147483647) in SOAP requests
Submitted: 2004-09-10 03:34 UTC Modified: 2004-09-14 14:18 UTC
From: paulmonk at shaw dot ca Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5.0.1 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: paulmonk at shaw dot ca
New email:
PHP Version: OS:

 

 [2004-09-10 03:34 UTC] paulmonk at shaw dot ca
Description:
------------
It seems that xsd:long values > 2147483647 are not represented correctly in SOAP requests/responses. Looks like they are being treated as PHP integers. (Unsigned longs work fine.)

Reproduce code:
---------------
When I pass the following parameters in a SoapClient::__call():

$long1 = new SoapVar(2147483647, XSD_LONG);
$long2 = new SoapVar(2147483648, XSD_LONG);
$long3 = new SoapVar(4294967296, XSD_LONG);
$long4 = new SoapVar(8589934592, XSD_LONG);
$long5 = new SoapVar(17179869184, XSD_LONG); 

$ulong1 = new SoapVar(2147483647, XSD_UNSIGNEDLONG);
$ulong2 = new SoapVar(2147483648, XSD_UNSIGNEDLONG);
$ulong3 = new SoapVar(4294967296, XSD_UNSIGNEDLONG);
$ulong4 = new SoapVar(8589934592, XSD_UNSIGNEDLONG);
$ulong5 = new SoapVar(17179869184, XSD_UNSIGNEDLONG);



Expected result:
----------------
The parameters in the SOAP request should be:
...
<long1 xsi:type="xsd:long">2147483647</long1>
<long2 xsi:type="xsd:long">2147483648</long2>
<long3 xsi:type="xsd:long">4294967296</long3>
<long4 xsi:type="xsd:long">8589934592</long4>
<long5 xsi:type="xsd:long">17179869184</long5>

<ulong1 xsi:type="xsd:unsignedLong">2147483647</ulong1>
<ulong2 xsi:type="xsd:unsignedLong">2147483648</ulong2>
<ulong3 xsi:type="xsd:unsignedLong">4294967296</ulong3>
<ulong4 xsi:type="xsd:unsignedLong">8589934592</ulong4>
<ulong5 xsi:type="xsd:unsignedLong">17179869184</ulong5>

Actual result:
--------------
The actual parameters in the SOAP request are:
...
<long1 xsi:type="xsd:long">2147483647</long1>
<long2 xsi:type="xsd:long">-2147483648</long2>
<long3 xsi:type="xsd:long">0</long3>
<long4 xsi:type="xsd:long">0</long4>
<long5 xsi:type="xsd:long">0</long5>

<ulong1 xsi:type="xsd:unsignedLong">2147483647</ulong1>
<ulong2 xsi:type="xsd:unsignedLong">2147483648</ulong2>
<ulong3 xsi:type="xsd:unsignedLong">4294967296</ulong3>
<ulong4 xsi:type="xsd:unsignedLong">8589934592</ulong4>
<ulong5 xsi:type="xsd:unsignedLong">17179869184</ulong5>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-10 09:19 UTC] derick@php.net
No bug here, PHP simply doesn't understand integers larger than 2147483647.
 [2004-09-10 10:08 UTC] paulmonk at shaw dot ca
If PHP doesn't understand integers larger than 2147483647, why is it that unsigned longs work as expected up to 17179869184 (and beyond)? In that case, one would expect long values up to at least 8589934592 to be supported. Please note that I'm talking specifically about passing different data types to the SOAP extension, not PHP's handling of integers.

How does one assign a long value? If the XSD_LONG constant exists, there should be some way to pass a long.
 [2004-09-10 10:26 UTC] derick@php.net
Can you shed some light on this DMitry?
 [2004-09-14 14:18 UTC] dmitry@php.net
Fixed in CVS HEAD and PHP_5_0.

ext/soap doesn't validate integer type constranits and it cannot handle integer numbers those cannot fit into C double.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 12:01:26 2024 UTC