|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41344 Error returning long values in the headers
Submitted: 2007-05-10 07:07 UTC Modified: 2007-05-10 20:04 UTC
From: zeta2ste2000 at yahoo dot it Assigned:
Status: Not a bug Package: SOAP related
PHP Version: 5.2.2 OS: HP-UX 11.11
Private report: No CVE-ID: None
 [2007-05-10 07:07 UTC] zeta2ste2000 at yahoo dot it
When I have to manage a long number in the header, the __soapCall function returns a float number in exponential format. The original sent value can't be retrieved and the returned one is different.

Reproduce code:
A Java server sends a sessionID in the header with the following value : 339051398236687110
This is the client code :

    $soapclient->__soapCall('beginSession',$parameters, null, null, $header);
    echo $header["sessionID"]; // returns 3.3905139823669E+17 , an  
                               // invalid value for the next call
                               // and with less digits than required
    $strNum = number_format($header["sessionID"], 0, "", "");
    echo $strNum;              // returns the rounded value
                               // 339051398236687050 , that is 
                               // different from the original
                               // 339051398236687110


Expected result:
The header has to contain 339051398236687110

Actual result:
The header contain 3.3905139823669E+17


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-10 20:04 UTC]
Floating point values have a limited precision. Hence a value might 
not have the same string representation after any processing. That also
includes writing a floating point value in your script and directly 
printing it without any mathematical operations.

If you would like to know more about "floats" and what IEEE
754 is read this:
Thank you for your interest in PHP.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Feb 24 23:01:27 2024 UTC