|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36999 xsd:long values clamped to LONG_MAX instead of using double
Submitted: 2006-04-06 15:51 UTC Modified: 2006-04-18 01:00 UTC
Avg. Score:3.7 ± 0.9
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: hammondb at yahoo-inc dot com Assigned: dmitry (profile)
Status: No Feedback Package: SOAP related
PHP Version: 5.1.2 OS: RHEL 4
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-04-06 15:51 UTC] hammondb at yahoo-inc dot com
SoapClient in WSDL mode with classmap option creates object attribute mapped to a xsd:long in the WSDL as a long with value LONG_MAX when the returned value from a SOAP call is outside the range of a signed long (4-byte) integer.  

The code and bug #30045 says that when ERANGE occurs in strtol a double is used instead.  However, the value is still set to LONG_MAX (what strtol returns when errno is ERANGE).  

ext/soap's php_encoding.c seems to be where the error is located.

relevant section of WSDL:

<xsd:complexType name="Campaign">
<xsd:element minOccurs="0" name="ID" type="xsd:long"/>

The value of a returned ID from a SOAP call that returns a Campaign ComplexType is 3706790240 but the value of my Campaign object's ID attribute is 2147483647 (LONG_MAX).

Reproduce code:
$s = new SoapClient($wsdlPath, array('trace' => 1, 'exceptions' => 1));

try {
  $res = $s->doSomething();
  echo $res->out->ID . "\n";
} catch (SoapFault $fault) {

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-10 11:27 UTC]
I cannot reproduce the bug.
Doyubles work fine for me.

Please provide WSDL and response XML from server.
Do you see 3706790240 in the response XML?
 [2006-04-18 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".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 21:01:28 2024 UTC