Bug #73431 [Com]: Loss of precision with xsd:integer and other huge integer types

From: Date: Thu, 13 Aug 2020 12:37:06 +0000
Subject: Bug #73431 [Com]: 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-228568@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 Comment 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.2.21 Block user comment: N Private report: N New Comment: PLEASE add the proposed little fix to 8.0 With the switch to 8.0, this very minor backward incompatibility is really no problem. Previous Comments: ------------------------------------------------------------------------ [2020-07-05 00:03:00] perske at uni-muenster dot de Please fix in the upcoming 8.0. This bug is really annoying. ------------------------------------------------------------------------ [2019-09-28 23:45:57] perske at uni-muenster dot de Please check and implement the fix I have proposed. It hardly does break anything and it helps in many use cases of SOAP. ------------------------------------------------------------------------ [2016-10-31 16:51:01] perske at uni-muenster dot de 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). ------------------------------------------------------------------------ [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

« previous php.bugs (#228568) next »