com php-src: Fixed bug #71996: NEWS ext/soap/php_encoding.c ext/soap/tests/bug71996.phpt
| From: | Nikita Popov | Date: | Tue, 30 Aug 2016 15:20:55 +0000 |
| Subject: | com php-src: Fixed bug #71996: NEWS ext/soap/php_encoding.c ext/soap/tests/bug71996.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94166@lists.php.net to get a copy of this message | ||
Commit: 8e487aefaaf88bdad6343da06286bfc86063836c
Author: Nikita Popov <nikic@php.net> Tue, 30 Aug 2016 17:19:19 +0200
Parents: 972302d2f0bb12689db280df8a3daadb0d5003b3
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8e487aefaaf88bdad6343da06286bfc86063836c
Log:
Fixed bug #71996
Bugs:
https://bugs.php.net/71996
Changed paths:
M NEWS
M ext/soap/php_encoding.c
A ext/soap/tests/bug71996.phpt
Diff:
diff --git a/NEWS b/NEWS
index 36b01a3..37daabe 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ PHP NEWS
- mbstring:
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
+- SOAP:
+ . Fixed bug #71996 (Using references in arrays doesn't work like expected).
+ (Nikita)
+
- Standard:
. Fixed bug #71882 (Negative ftruncate() on php://memory exhausts memory).
(cmb)
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index fc389f2..9c9e4e9 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -2120,6 +2120,7 @@ static void add_xml_array_elements(xmlNodePtr xmlParam,
if (j >= dims[0]) {
break;
}
+ ZVAL_DEREF(zdata);
if (dimension == 1) {
if (enc == NULL) {
xparam = master_to_xml(get_conversion(Z_TYPE_P(zdata)), zdata, style, xmlParam);
diff --git a/ext/soap/tests/bug71996.phpt b/ext/soap/tests/bug71996.phpt
new file mode 100644
index 0000000..c4bb092
--- /dev/null
+++ b/ext/soap/tests/bug71996.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #71996: Using references in arrays doesn't work like expected
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+$client = new class(null, ['location' => '', 'uri' => 'http://example.org']) extends SoapClient {
+ public function __doRequest($request, $location, $action, $version, $one_way = 0) {
+ echo $request;
+ return '';
+ }
+};
+$ref = array("foo");
+$data = array(&$ref);
+$client->foo($data);
+
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://example.org"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:foo><param0
SOAP-ENC:arrayType="SOAP-ENC:Array[1]" xsi:type="SOAP-ENC:Array"><item
SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item
xsi:type="xsd:string">foo</item></item></param0></ns1:foo></SOAP-ENV:Body></SOAP-ENV:Envelope>