Skip to content

Commit 5168373

Browse files
committed
Fixed bug #72647 (xmlrpc_encode() unexpected output after referencing array elements)
1 parent 9a2207c commit 5168373

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ PHP NEWS
8181
. Fixed bug #72330 (CSV fields incorrectly split if escape char followed by
8282
UTF chars). (cmb)
8383

84+
- XMLRPC:
85+
. Fixed bug #72647 (xmlrpc_encode() unexpected output after referencing
86+
array elements). (Laruence)
87+
88+
8489
- Wddx:
8590
. Fixed bug #72564 (boolean always deserialized as "true") (Remi)
8691

ext/xmlrpc/tests/bug72647.phpt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
Bug #72647 (xmlrpc_encode() unexpected output after referencing array elements)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded("xmlrpc")) print "skip";
6+
?>
7+
--FILE--
8+
<?php
9+
10+
$ar = array(4, "a", 7);
11+
$v = &$ar[1];
12+
unset($v);
13+
14+
echo xmlrpc_encode($ar);
15+
?>
16+
--EXPECTF--
17+
<?xml version="1.0" encoding="utf-8"?>
18+
<params>
19+
<param>
20+
<value>
21+
<array>
22+
<data>
23+
<value>
24+
<int>4</int>
25+
</value>
26+
<value>
27+
<string>a</string>
28+
</value>
29+
<value>
30+
<int>7</int>
31+
</value>
32+
</data>
33+
</array>
34+
</value>
35+
</param>
36+
</params>

ext/xmlrpc/xmlrpc-epi-php.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
568568
xReturn = XMLRPC_CreateVector(key, vtype);
569569

570570
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(val_arr), num_index, my_key, pIter) {
571+
ZVAL_DEREF(pIter);
571572
ht = HASH_OF(pIter);
572573
if (ht) {
573574
ht->u.v.nApplyCount++;

0 commit comments

Comments
 (0)