Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.14.0

Bug #14806 Wrong value for xsd:unsignedLong's greater than PHP_INT_MAX
Submitted: 2008-10-16 12:34 UTC
From: pet Assigned:
Status: Open Package: SOAP (version CVS)
PHP Version: 5.1.2 OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-10-16 12:34 UTC] pet (Patrick Kuijvenhoven)
Description: ------------ I have a SOAPfunction that returns xsd:unsignedLong's. The PEAR::SOAP client returns a value 2147483647 (in my case equal to PHP_INT_MAX) when the value is larger than 2147483647. An ugly workaroung would be something like this: $client->{'_typemap'}['http://www.w3.org/2001/XMLSchema']['unsignedLong'] = 'string'; Test script: --------------- require_once 'SOAP/Client.php'; $string = <<<EOS <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="http://soapinterop.org/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body> <ns4:phpIntMaxResponse><total xsi:type="xsd:unsignedLong">2853166989</total></ns4:phpIntMaxResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> EOS; $client = new SOAP_Client(); # Ugly workaround: # $client->{'_typemap'}['http://www.w3.org/2001/XMLSchema']['unsignedLong'] = 'string'; print($client->parseResponse($string))."\n"; Expected result: ---------------- 2853166989 Actual result: -------------- 2147483647

Comments

 [2008-10-16 13:11 UTC] pet (Patrick Kuijvenhoven)
Something went wrong when I copy/pasted the test-script. Of course, the line after the 'ugly workaround'-comment should be commented as well.
 [2008-12-28 01:17 UTC] doconnor (Daniel O'Connor)
We'd either have to swap it over to treat it as a string, or find a system with a bigger PHP_INT_MAX... Mushing it into a string as you've described scares me, personally.