Bug #73431 [NEW]: Loss of precision with xsd:integer and other huge integer types
| From: | perske at uni-muenster dot de | Date: | Mon, 31 Oct 2016 15:45:49 +0000 |
| Subject: | Bug #73431 [NEW]: Loss of precision with xsd:integer and other huge integer types | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205111@lists.php.net to get a copy of this message | ||
From: perske at uni-muenster dot de
Operating system: all
PHP version: 7.0.12
Package: SOAP related
Bug Type: Bug
Bug description:Loss of precision with xsd:integer and other huge integer types
Description:
------------
If a server returns a use integer like in
<Serial xsi:type="xsd:integer">8688597941889535165991696066</Serial>
The PHP script does not get the complete huge integer but a rounded
float like
86885979418895E+27
This is inacceptable for most use cases.
To fix, modify ext/soap/php_encoding.c: Replace the line:
{{XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long,
to_xml_long},
with the line
{{XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, NULL},
to_zval_stringc, to_xml_string},
The same should be done with these lines:
{{XSD_NONPOSITIVEINTEGER, XSD_NONPOSITIVEINTEGER_STRING, XSD_NAMESPACE,
NULL}, to_zval_long, to_xml_long},
{{XSD_POSITIVEINTEGER, XSD_POSITIVEINTEGER_STRING, XSD_NAMESPACE, NULL},
to_zval_long, to_xml_long},
{{XSD_NONNEGATIVEINTEGER, XSD_NONNEGATIVEINTEGER_STRING, XSD_NAMESPACE,
NULL}, to_zval_long, to_xml_long},
{{XSD_NEGATIVEINTEGER, XSD_NEGATIVEINTEGER_STRING, XSD_NAMESPACE, NULL},
to_zval_long, to_xml_long},
{{XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long,
to_xml_long},
Test script:
---------------
n/a
--
Edit bug report at https://bugs.php.net/bug.php?id=73431&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73431&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73431&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73431&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73431&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73431&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73431&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73431&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73431&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73431&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73431&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73431&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73431&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73431&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73431&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73431&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73431&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73431&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73431&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73431&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73431&r=mysqlcfg