Skip to content

Commit 77646d2

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fix #77141: Signedness issue in SOAP when precision=-1
2 parents 1550451 + f6079e3 commit 77646d2

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ PHP NEWS
1818
. Fixed bug #50675 (SoapClient can't handle object references correctly).
1919
(Cameron Porter)
2020
. Fixed bug #76348 (WSDL_CACHE_MEMORY causes Segmentation fault). (cmb)
21+
. Fixed bug #77141 (Signedness issue in SOAP when precision=-1). (cmb)
2122

2223
08 Nov 2018, PHP 7.2.12
2324

ext/soap/php_encoding.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,7 @@ static xmlNodePtr to_xml_double(encodeTypePtr type, zval *data, int style, xmlNo
10861086

10871087
ZVAL_DOUBLE(&tmp, zval_get_double(data));
10881088

1089-
str = (char *) safe_emalloc(EG(precision), 1, MAX_LENGTH_OF_DOUBLE + 1);
1089+
str = (char *) safe_emalloc(EG(precision) >= 0 ? EG(precision) : 17, 1, MAX_LENGTH_OF_DOUBLE + 1);
10901090
php_gcvt(Z_DVAL(tmp), EG(precision), '.', 'E', str);
10911091
xmlNodeSetContentLen(ret, BAD_CAST(str), strlen(str));
10921092
efree(str);

ext/soap/tests/bugs/bug77141.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Bug #77141 (Signedness issue in SOAP when precision=-1)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('soap')) die('skip soap extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$soap = new \SoapClient(
10+
null,
11+
array(
12+
'location' => "http://localhost/soap.php",
13+
'uri' => "http://localhost/",
14+
'style' => SOAP_RPC,
15+
'trace' => true,
16+
'exceptions' => false,
17+
)
18+
);
19+
ini_set('precision', -1);
20+
$soap->call(1.1);
21+
echo $soap->__getLastRequest();
22+
?>
23+
===DONE===
24+
--EXPECT--
25+
<?xml version="1.0" encoding="UTF-8"?>
26+
<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>
27+
===DONE===

0 commit comments

Comments
 (0)