Fixed bug #72647 (xmlrpc_encode() unexpected output after referencing array elements)

This commit is contained in:
Xinchen Hui 2016-07-22 23:13:42 +08:00
parent 9a2207c90a
commit 516837344e
3 changed files with 42 additions and 0 deletions

5
NEWS
View File

@ -81,6 +81,11 @@ PHP NEWS
. Fixed bug #72330 (CSV fields incorrectly split if escape char followed by
UTF chars). (cmb)
- XMLRPC:
. Fixed bug #72647 (xmlrpc_encode() unexpected output after referencing
array elements). (Laruence)
- Wddx:
. Fixed bug #72564 (boolean always deserialized as "true") (Remi)

View File

@ -0,0 +1,36 @@
--TEST--
Bug #72647 (xmlrpc_encode() unexpected output after referencing array elements)
--SKIPIF--
<?php
if (!extension_loaded("xmlrpc")) print "skip";
?>
--FILE--
<?php
$ar = array(4, "a", 7);
$v = &$ar[1];
unset($v);
echo xmlrpc_encode($ar);
?>
--EXPECTF--
<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
<value>
<array>
<data>
<value>
<int>4</int>
</value>
<value>
<string>a</string>
</value>
<value>
<int>7</int>
</value>
</data>
</array>
</value>
</param>
</params>

View File

@ -568,6 +568,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
xReturn = XMLRPC_CreateVector(key, vtype);
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(val_arr), num_index, my_key, pIter) {
ZVAL_DEREF(pIter);
ht = HASH_OF(pIter);
if (ht) {
ht->u.v.nApplyCount++;