Bug #73431 [Opn]: Loss of precision with xsd:integer and other huge integer types
| From: | perske at uni-muenster dot de | Date: | Mon, 31 Oct 2016 16:51:02 +0000 |
| Subject: | Bug #73431 [Opn]: Loss of precision with xsd:integer and other huge integer types | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-205112@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73431&edit=1
ID: 73431
User updated by: perske at uni-muenster dot de
Reported by: perske at uni-muenster dot de
Summary: Loss of precision with xsd:integer and other huge
integer types
Status: Open
Type: Bug
Package: SOAP related
Operating System: all
PHP Version: 7.0.12
Block user comment: N
Private report: N
New Comment:
The change from to_xml_long to to_xml_string is not necessary,
but to_zval_long must be changed to to_zval_stringc (or to_zval_string).
Previous Comments:
------------------------------------------------------------------------
[2016-10-31 15:45:45] perske at uni-muenster dot de
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 this bug report at https://bugs.php.net/bug.php?id=73431&edit=1