diff options
author | Xinchen Hui <laruence@gmail.com> | 2016-07-22 23:13:42 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2016-07-22 23:13:42 +0800 |
commit | 516837344e5de91e2524d503a3f91c4bd9c8dadd (patch) | |
tree | 06b63dbab122449f0645a779d4c22ddea0c09905 | |
parent | 9a2207c90ae1c699d9e34223f51b6c13dfbda798 (diff) | |
download | php-git-516837344e5de91e2524d503a3f91c4bd9c8dadd.tar.gz |
Fixed bug #72647 (xmlrpc_encode() unexpected output after referencing array elements)
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | ext/xmlrpc/tests/bug72647.phpt | 36 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 1 |
3 files changed, 42 insertions, 0 deletions
@@ -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) diff --git a/ext/xmlrpc/tests/bug72647.phpt b/ext/xmlrpc/tests/bug72647.phpt new file mode 100644 index 0000000000..9334cbda51 --- /dev/null +++ b/ext/xmlrpc/tests/bug72647.phpt @@ -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> diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index b5dcee8f0d..fa962dd74e 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -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++; |