diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-11-12 23:21:04 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-11-12 23:22:16 +0100 |
commit | 77646d2fd939e9d6af1a8a47f8550b3f680d1456 (patch) | |
tree | cda2edf5d39eb4506a18f8b37311f582de64e028 | |
parent | 155045102072e673da80e06b925d22d27088d2b2 (diff) | |
parent | f6079e3c56eabe03565faceaef9de12728d278bf (diff) | |
download | php-git-77646d2fd939e9d6af1a8a47f8550b3f680d1456.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fix #77141: Signedness issue in SOAP when precision=-1
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/soap/php_encoding.c | 2 | ||||
-rw-r--r-- | ext/soap/tests/bugs/bug77141.phpt | 27 |
3 files changed, 29 insertions, 1 deletions
@@ -18,6 +18,7 @@ PHP NEWS . Fixed bug #50675 (SoapClient can't handle object references correctly). (Cameron Porter) . Fixed bug #76348 (WSDL_CACHE_MEMORY causes Segmentation fault). (cmb) + . Fixed bug #77141 (Signedness issue in SOAP when precision=-1). (cmb) 08 Nov 2018, PHP 7.2.12 diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 6051995713..2afb31d779 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -1086,7 +1086,7 @@ static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style, xmlNo ZVAL_DOUBLE(&tmp, zval_get_double(data)); - str = (char *) safe_emalloc(EG(precision), 1, MAX_LENGTH_OF_DOUBLE + 1); + str = (char *) safe_emalloc(EG(precision) >= 0 ? EG(precision) : 17, 1, MAX_LENGTH_OF_DOUBLE + 1); php_gcvt(Z_DVAL(tmp), EG(precision), '.', 'E', str); xmlNodeSetContentLen(ret, BAD_CAST(str), strlen(str)); efree(str); diff --git a/ext/soap/tests/bugs/bug77141.phpt b/ext/soap/tests/bugs/bug77141.phpt new file mode 100644 index 0000000000..fa38cc6959 --- /dev/null +++ b/ext/soap/tests/bugs/bug77141.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #77141 (Signedness issue in SOAP when precision=-1) +--SKIPIF-- +<?php +if (!extension_loaded('soap')) die('skip soap extension not available'); +?> +--FILE-- +<?php +$soap = new \SoapClient( + null, + array( + 'location' => "http://localhost/soap.php", + 'uri' => "http://localhost/", + 'style' => SOAP_RPC, + 'trace' => true, + 'exceptions' => false, + ) +); +ini_set('precision', -1); +$soap->call(1.1); +echo $soap->__getLastRequest(); +?> +===DONE=== +--EXPECT-- +<?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://localhost/" 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:call><param0 xsi:type="xsd:float">1.1</param0></ns1:call></SOAP-ENV:Body></SOAP-ENV:Envelope> +===DONE=== |