From: Antony Dovgal Date: Fri, 15 Sep 2006 09:11:31 +0000 (+0000) Subject: fix leak when call to shutdown function fails X-Git-Tag: RELEASE_1_0_0RC1~1666 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c912fa4a908876c283241b71e6fe6a2d6b88677d;p=php fix leak when call to shutdown function fails --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 7f4d06b62e..f9782bf0a9 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -5214,16 +5214,20 @@ static int user_shutdown_function_call(php_shutdown_function_entry *shutdown_fun if (!zend_is_callable(shutdown_function_entry->arguments[0], 0, &function_name)) { php_error(E_WARNING, "(Registered shutdown functions) Unable to call %R() - function does not exist", Z_TYPE(function_name), Z_UNIVAL(function_name)); - } else if (call_user_function(EG(function_table), NULL, - shutdown_function_entry->arguments[0], - &retval, - shutdown_function_entry->arg_count - 1, - shutdown_function_entry->arguments + 1 - TSRMLS_CC ) == SUCCESS) + zval_dtor(&function_name); + return 0; + } + zval_dtor(&function_name); + + if (call_user_function(EG(function_table), NULL, + shutdown_function_entry->arguments[0], + &retval, + shutdown_function_entry->arg_count - 1, + shutdown_function_entry->arguments + 1 + TSRMLS_CC ) == SUCCESS) { zval_dtor(&retval); } - zval_dtor(&function_name); return 0; } diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt new file mode 100644 index 0000000000..8d1075f842 --- /dev/null +++ b/ext/standard/tests/general_functions/010.phpt @@ -0,0 +1,25 @@ +--TEST-- +register_shutdown_function() & __call +--FILE-- + +--EXPECTF-- +Strict Standards: Non-static method test::__call() cannot be called statically in %s on line %d +NULL +Done + +Strict Standards: Non-static method test::__call() cannot be called statically in Unknown on line 0 + +Fatal error: Non-static method test::__call() cannot be called statically in Unknown on line 0