From: Sascha Schumann Date: Thu, 3 Apr 2003 18:09:41 +0000 (+0000) Subject: Prevent entering of anything but arrays/strings in register_shutdown_func X-Git-Tag: RELEASE_0_5~169 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e7bbb751e7c4531a7787a07d65008e401406e5a;p=php Prevent entering of anything but arrays/strings in register_shutdown_func Noticed by: Jan Schneider --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e81446dc60..9ae0e20a85 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -2173,7 +2173,12 @@ PHP_FUNCTION(register_shutdown_function) if (zend_get_parameters_array(ht, shutdown_function_entry.arg_count, shutdown_function_entry.arguments) == FAILURE) { RETURN_FALSE; } - convert_to_string(shutdown_function_entry.arguments[0]); + + /* Prevent entering of anything but arrays/strings */ + if (Z_TYPE_P(shutdown_function_entry.arguments[0]) != IS_ARRAY) { + convert_to_string(shutdown_function_entry.arguments[0]); + } + if (!BG(user_shutdown_function_names)) { ALLOC_HASHTABLE(BG(user_shutdown_function_names)); zend_hash_init(BG(user_shutdown_function_names), 0, NULL, (void (*)(void *)) user_shutdown_function_dtor, 0);