Patch bug47624.patch for SOAP related Bug #47624
Patch version 2014-05-07 13:58 UTC
Return to Bug #47624 |
Download this patch
Patch Revisions:
Developer: nbk@sitadelle.com
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 12f23bf..49bfca6 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -149,7 +149,7 @@ encode defaultEncoding[] = {
{{IS_NULL, "nil", XSI_NAMESPACE, NULL}, to_zval_null, to_xml_null},
{{IS_STRING, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
- {{IS_LONG, XSD_INT_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
+ {{IS_LONG, XSD_LONG_STRING, XSD_NAMESPACE, NULL}, to_zval_long, to_xml_long},
{{IS_DOUBLE, XSD_FLOAT_STRING, XSD_NAMESPACE, NULL}, to_zval_double, to_xml_double},
{{IS_BOOL, XSD_BOOLEAN_STRING, XSD_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
{{IS_CONSTANT, XSD_STRING_STRING, XSD_NAMESPACE, NULL}, to_zval_string, to_xml_string},
@@ -2805,7 +2805,7 @@ static xmlNodePtr to_xml_map(encodeTypePtr type, zval *data, int style, xmlNodeP
smart_str_0(&tmp);
if (style == SOAP_ENCODED) {
- set_xsi_type(key, "xsd:int");
+ set_xsi_type(key, XSD_NS_PREFIX ":" XSD_LONG_STRING);
}
xmlNodeSetContentLen(key, BAD_CAST(tmp.c), tmp.len);
diff --git a/ext/soap/tests/bugs/bug47624.phpt b/ext/soap/tests/bugs/bug47624.phpt
new file mode 100644
index 0000000..4172d69
--- /dev/null
+++ b/ext/soap/tests/bugs/bug47624.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #47624 (SOAP response has int type for a value that is out of range)
+See http://www.w3.org/TR/xmlschema-2/#int
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ class IntOverflow {
+ public function Method() {
+ return 884385070380;
+ }
+ }
+
+ $input =
+ '<?xml version="1.0"?>'.PHP_EOL.
+ '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="namespace1"'.
+ ' xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'.
+ ' xmlns:xsd="http://www.w3.org/2001/XMLSchema">'.
+ '<SOAP-ENV:Body><ns1:Method /></SOAP-ENV:Body></SOAP-ENV:Envelope>';
+
+ $soap = new SoapServer(null, array('uri' => '127.0.0.1'));
+ $soap->setClass('IntOverflow');
+ $soap->handle($input);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="127.0.0.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:MethodResponse><return xsi:type="xsd:long">884385070380</return></ns1:MethodResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
|