Bug #48717 [Com]: Cannot pass datatype long (> 2147483647) in SOAP requests

From: Date: Fri, 28 Oct 2016 15:19:23 +0000
Subject: Bug #48717 [Com]: Cannot pass datatype long (> 2147483647) in SOAP requests
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205055@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48717&edit=1

 ID:                 48717
 Comment by:         perske at uni-muenster dot de
 Reported by:        rob at zcore dot org
 Summary:            Cannot pass datatype long (> 2147483647) in SOAP
                     requests
 Status:             Open
 Type:               Bug
 Package:            SOAP related
 Operating System:   Debian GNU/Linux
 PHP Version:        5.2.11
 Block user comment: N
 Private report:     N

 New Comment:

Simple Fix:

In ext/soap/php_encoding.c, in all lines containing

  XSD_...INTEGER

i.e. for all XML data types containing integers of unlimited size,
replace "long" with "string", e.g.

        {{XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},

becomes

        {{XSD_INTEGER, XSD_INTEGER_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},

This fix brings a minor incompatibility if somebody checks value and type of the result of a SOAP
function.
(An alternative would be to add a function to_zval_long_or_string that returns an integer if it fits
and otherwise a string.)


Previous Comments:
------------------------------------------------------------------------
[2016-10-28 11:54:18] perske at uni-muenster dot de

Even if you pass a huge integer as a string it is mixed up.

Reason: PHP 5.6.23, file ext/soap/php_encoding.c, function to_xml_long:

Line 1118:

                if (Z_TYPE(tmp) != IS_LONG) {
                        convert_to_long(&tmp);
                }
                convert_to_string(&tmp);

If a string is passed, it should not be converted to long and back to string loosing precision with
very long integers.

------------------------------------------------------------------------
[2015-07-21 19:47:50] cmb@php.net

Related To: Bug #47624

------------------------------------------------------------------------
[2014-05-30 11:17:05] dev dot rindeal+bugs dot php dot net at outlook dot com

PHP 5.5.12 x86 on Windows 8 and it's still there. Thankfully the workaround in the comment #1
works for me. Thank you "ghostbaer at gmx dot de", you saved my work.

------------------------------------------------------------------------
[2010-10-27 20:46:44] pajoye@php.net

try:

$a = "1234";
$b = 1234;

if ($a == $b) echo "hopla";

well known problem related to php auto casting, or better said, typeless.

------------------------------------------------------------------------
[2010-10-27 20:20:24] periklis dot tsirakidis at mayflower dot de

Ouch... Pierre, 

one serious notice is, that we changed the wsdl for <options> from xsd:long to xsd:string and
the problem is still there. Do we have here an auto-casting from string to long?

Any ideas?

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=48717


--
Edit this bug report at https://bugs.php.net/bug.php?id=48717&edit=1


Thread (17 messages)

« previous php.bugs (#205055) next »