|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-06-29 11:06 UTC] rob at zcore dot org
Description:
------------
For some reason
Array
(
[0] => dummy Object
(
[id] => 10047678003
[pass] => XxX
)
)
is transformed to
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://impl.ejb.flog.zcore.org/">
<SOAP-ENV:Body>
<ns1:authenticate>
<id>2147483647</id>
<pass>XxX</pass>
</ns1:authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
while it's based on this XSD snipplet:
<xs:complexType name="authenticate">
<xs:sequence>
<xs:element name="id" type="xs:long"></xs:element>
<xs:element name="pass" type="xs:string" minOccurs="0"></xs:element>
</xs:sequence>
</xs:complexType>
Expected result:
----------------
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://impl.ejb.flog.zcore.org/">
<SOAP-ENV:Body>
<ns1:authenticate>
<id>10047678003</id>
<pass>XxX</pass>
</ns1:authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Actual result:
--------------
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://impl.ejb.flog.zcore.org/">
<SOAP-ENV:Body>
<ns1:authenticate>
<id>2147483647</id>
<pass>XxX</pass>
</ns1:authenticate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 19:00:01 2025 UTC |
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.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.)