From c9fc939be0dd02679b44dc419b2bcbccb39a2365 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Fri, 14 May 2010 23:48:03 +0000 Subject: [PATCH] - Fixed bug #51827 (Bad warning when register_shutdown_function called with wrong num of parameters) --- NEWS | 2 ++ Zend/tests/bug51827.phpt | 19 +++++++++++++++++++ Zend/zend_API.c | 6 +++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 Zend/tests/bug51827.phpt diff --git a/NEWS b/NEWS index a7b4a6b1da..0f0bf189b0 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,8 @@ PHP NEWS requests (Fixes CVE-2010-0397, bug #51288). (Raphael Geissert) - Fixed 64-bit integer overflow in mhash_keygen_s2k(). (Clément LECIGNE, Stas) +- Fixed bug #51827 (Bad warning when register_shutdown_function called with + wrong num of parameters). (Felipe) - Fixed bug #51791 (constant() aborts execution when fail to check undefined constant). (Felipe) - Fixed bug #51732 (Fileinfo __construct or open does not work with NULL). diff --git a/Zend/tests/bug51827.phpt b/Zend/tests/bug51827.phpt new file mode 100644 index 0000000000..0834749454 --- /dev/null +++ b/Zend/tests/bug51827.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #51827 (Bad warning when register_shutdown_function called with wrong num of parameters) +--FILE-- + +--EXPECTF-- +int(1) + +Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 49464705da..f8ce293210 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -721,7 +721,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", class_name, class_name[0] ? "::" : "", - get_active_function_name(TSRMLS_C)); + active_function->common.function_name); } return FAILURE; } @@ -741,7 +741,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", class_name, class_name[0] ? "::" : "", - get_active_function_name(TSRMLS_C)); + active_function->common.function_name); } return FAILURE; } @@ -764,7 +764,7 @@ static int zend_parse_va_args(int num_args, char *type_spec, va_list *va, int fl zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", class_name, class_name[0] ? "::" : "", - get_active_function_name(TSRMLS_C), + active_function->common.function_name, min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", -- 2.40.0