From: Andi Gutmans Date: Mon, 14 Feb 2000 19:08:51 +0000 (+0000) Subject: - Fix bug in func_get_arg() X-Git-Tag: BEFORE_SAPI_POST_PATCH_17_FEB_2000~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=95c77887471af4aaa8ecba445b7e69c0e46941e0;p=php - Fix bug in func_get_arg() - Get rid of compiler warnings for unused function crash() --- diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 9de168c0da..7629955f1f 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -43,7 +43,9 @@ static ZEND_FUNCTION(method_exists); static ZEND_FUNCTION(class_exists); static ZEND_FUNCTION(function_exists); static ZEND_FUNCTION(leak); +#ifdef ZEND_TEST_EXCEPTIONS static ZEND_FUNCTION(crash); +#endif static ZEND_FUNCTION(get_used_files); static ZEND_FUNCTION(get_imported_files); static ZEND_FUNCTION(is_subclass_of); @@ -135,8 +137,8 @@ ZEND_FUNCTION(func_get_arg) } arg_count = (ulong) *p; - if (requested_offset>arg_count) { - zend_error(E_WARNING, "func_get_arg(): Only %d arguments passed to function (argument %d requested)", arg_count, requested_offset); + if (requested_offset>=arg_count) { + zend_error(E_WARNING, "func_get_arg(): Argument %d not passed to function", requested_offset); RETURN_FALSE; } @@ -537,12 +539,14 @@ ZEND_FUNCTION(leak) } +#ifdef ZEND_TEST_EXCEPTIONS ZEND_FUNCTION(crash) { char *nowhere=NULL; memcpy(nowhere, "something", sizeof("something")); } +#endif static int copy_import_use_file(zend_file_handle *fh, zval *array)