From: Etienne Kneuss Date: Mon, 6 Oct 2008 13:45:42 +0000 (+0000) Subject: MFH: bug #46115 (Fixes nothing in 5.2, but sync code) X-Git-Tag: php-5.2.7RC1~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af17616e0e1df48b4db94e760987f8a384347d35;p=php MFH: bug #46115 (Fixes nothing in 5.2, but sync code) --- diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index 257b503dce..2760ceaace 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -1197,6 +1197,7 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); zval tmp, *arg; + zval *retval_ptr = NULL; INIT_PZVAL(&tmp); Z_TYPE(tmp) = IS_ARRAY; @@ -1207,9 +1208,12 @@ static void spl_array_method(INTERNAL_FUNCTION_PARAMETERS, char *fname, int fnam zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0 TSRMLS_CC); return; } - zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value_ptr, 2, &tmp, arg TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 2, &tmp, arg TSRMLS_CC); } else { - zend_call_method(NULL, NULL, NULL, fname, fname_len, return_value_ptr, 1, &tmp, NULL TSRMLS_CC); + zend_call_method(NULL, NULL, NULL, fname, fname_len, &retval_ptr, 1, &tmp, NULL TSRMLS_CC); + } + if (retval_ptr) { + COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr); } } diff --git a/ext/spl/tests/bug46115.phpt b/ext/spl/tests/bug46115.phpt new file mode 100644 index 0000000000..71207d8a25 --- /dev/null +++ b/ext/spl/tests/bug46115.phpt @@ -0,0 +1,11 @@ +--TEST-- +Bug #46115 (Memory leak when calling a method using Reflection) +--FILE-- +invoke($h); +?> +DONE +--EXPECT-- +DONE