php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40020 int values with leading zeroes
Submitted: 2007-01-04 13:20 UTC Modified: 2007-01-04 13:24 UTC
From: pav at oook dot cz Assigned:
Status: Not a bug Package: SOAP related
PHP Version: 5.2.0 OS: FreeBSD
Private report: No CVE-ID: None
 [2007-01-04 13:20 UTC] pav at oook dot cz
Description:
------------
I'm not totally convinced this is a valid SOAP, but anyway. I'm getting this from a SOAP::Lite server:

<inventory_number xsi:type="xsd:int">0022300455</inventory_number>

The value in PHP comes up as 4817197. The problem is that to_zval_long() calls strtol() with base 'zero', and libc function strtol() understands 0x* as hex (base 16) and 00* as octal (base 8) number, if base is unspecified (zero).

The fix here would be to change strtol() call to use base 10. Unless octal and hex representation of int is allowed in this datatype by specs.

I might also go to see why SOAP::Lite is tagging this as xsd:int instead of xsd:string.

What do you think about this, dmitry?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-04 13:22 UTC] tony2001@php.net
This is how PHP works for ages:
# php -r 'echo 0022300455;'
4817197
 [2007-01-04 13:24 UTC] pav at oook dot cz
Well, d'oh, yes, but this should be about what 0022300455 is supposed to mean in SOAP, not in PHP...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 18:01:28 2024 UTC