From: Zeev Suraski Date: Mon, 30 Jul 2001 05:36:18 +0000 (+0000) Subject: Zend compatibility patch X-Git-Tag: PRE_ENGINE2_SPLIT~204 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0224d51daa79a1b72df0e4a8213e425b5582102;p=php Zend compatibility patch --- diff --git a/ext/ereg/ereg.c b/ext/ereg/ereg.c index 7116dad68a..63344b8878 100644 --- a/ext/ereg/ereg.c +++ b/ext/ereg/ereg.c @@ -194,10 +194,6 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) if (zend_get_parameters_ex(3, ®ex, &findin, &array) == FAILURE) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 3)) { - php_error(E_WARNING, "Array to be filled with values must be passed by reference."); - RETURN_FALSE; - } break; default: WRONG_PARAM_COUNT; diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 845350a76f..7dd1cb7962 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -2321,11 +2321,6 @@ detect_end: n = 2; while (n < argc || stack_level > 0) { if (stack_level <= 0) { - if (!ParameterPassedByReference(ht, n + 1)) { - n++; - php_error(E_WARNING, "argument %d not passed by reference", n); - continue; - } var = args[n++]; if (Z_TYPE_PP(var) == IS_ARRAY || Z_TYPE_PP(var) == IS_OBJECT) { target_hash = HASH_OF(*var); diff --git a/ext/ovrimos/ovrimos.c b/ext/ovrimos/ovrimos.c index 63f8861007..6aeb07a002 100644 --- a/ext/ovrimos/ovrimos.c +++ b/ext/ovrimos/ovrimos.c @@ -699,12 +699,6 @@ PHP_FUNCTION(ovrimos_fetch_into) } } - if (!ParameterPassedByReference(ht, 2)) { /* 1-based?... */ - php_error(E_WARNING, - "Array not passed by reference in call to ovrimos_fetch_into()"); - RETURN_FALSE; - } - if (arr->type != IS_ARRAY) { if (array_init(arr) == FAILURE) { php_error(E_WARNING, @@ -1287,7 +1281,7 @@ function_entry ovrimos_functions[] = { PHP_FE(ovrimos_prepare, NULL) PHP_FE(ovrimos_execute, NULL) PHP_FE(ovrimos_fetch_row, NULL) - PHP_FE(ovrimos_fetch_into, NULL) + PHP_FE(ovrimos_fetch_into, second_arg_force_ref) PHP_FE(ovrimos_field_len, NULL) PHP_FE(ovrimos_field_name, NULL) PHP_FE(ovrimos_field_type, NULL) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 47da23fa28..cba769d12a 100755 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -40,7 +40,7 @@ static int pcntl_zend_extension_active; function_entry pcntl_functions[] = { PHP_FE(pcntl_fork, NULL) - PHP_FE(pcntl_waitpid, NULL) + PHP_FE(pcntl_waitpid, second_arg_force_ref) PHP_FE(pcntl_signal, NULL) PHP_FE(pcntl_wifexited, NULL) PHP_FE(pcntl_wifstopped, NULL) @@ -212,13 +212,7 @@ PHP_FUNCTION(pcntl_waitpid) } convert_to_long_ex(pid); - convert_to_long_ex(options); - - if (!ParameterPassedByReference(ht, 2)) { - php_error(E_WARNING, "Status not passed by reference in %s", get_active_function_name()); - RETURN_FALSE; - } - + convert_to_long_ex(options); convert_to_long_ex(status); if (ZEND_NUM_ARGS()==2) temp_options=0; diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 8d7dcb7ba2..50230cbd03 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -366,20 +366,12 @@ static void php_pcre_match(INTERNAL_FUNCTION_PARAMETERS, int global) } if (global) subpats_order_val = PREG_PATTERN_ORDER; - if (!ParameterPassedByReference(ht, 3)) { - zend_error(E_WARNING, "Array to be filled with matches must be passed by reference."); - RETURN_FALSE; - } break; case 4: if (zend_get_parameters_ex(4, ®ex, &subject, &subpats, &subpats_order) == FAILURE) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 3)) { - zend_error(E_WARNING, "Array to be filled with matches must be passed by reference."); - RETURN_FALSE; - } /* Make sure subpats_order is a number */ convert_to_long_ex(subpats_order); @@ -1378,8 +1370,6 @@ PHP_FUNCTION(preg_grep) /* {{{ module definition structures */ -unsigned char third_arg_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; - function_entry pcre_functions[] = { PHP_FE(preg_match, third_arg_force_ref) PHP_FE(preg_match_all, third_arg_force_ref) diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 7767ec275d..79ba88974b 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -72,7 +72,6 @@ php_basic_globals basic_globals; static unsigned char second_and_third_args_force_ref[] = { 3, BYREF_NONE, BYREF_FORCE, BYREF_FORCE }; static unsigned char second_args_force_ref[] = { 2, BYREF_NONE, BYREF_FORCE }; -static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE }; static unsigned char third_and_fourth_args_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_FORCE }; static unsigned char third_and_rest_force_ref[] = { 3, BYREF_NONE, BYREF_NONE, BYREF_FORCE_REST }; @@ -188,7 +187,7 @@ function_entry basic_functions[] = { PHP_FE(trim, NULL) PHP_FE(ltrim, NULL) PHP_FE(strip_tags, NULL) - PHP_FE(similar_text, third_argument_force_ref) + PHP_FE(similar_text, third_arg_force_ref) PHP_FE(explode, NULL) PHP_FE(implode, NULL) PHP_FE(setlocale, NULL) @@ -335,21 +334,21 @@ function_entry basic_functions[] = { PHP_FE(get_magic_quotes_gpc, NULL) PHP_FE(get_magic_quotes_runtime, NULL) - PHP_FE(is_null, first_arg_allow_ref) - PHP_FE(is_resource, first_arg_allow_ref) - PHP_FE(is_bool, first_arg_allow_ref) - PHP_FE(is_long, first_arg_allow_ref) - PHP_FALIAS(is_int, is_long, first_arg_allow_ref) - PHP_FALIAS(is_integer, is_long, first_arg_allow_ref) - PHP_FALIAS(is_float, is_double, first_arg_allow_ref) - PHP_FE(is_double, first_arg_allow_ref) - PHP_FALIAS(is_real, is_double, first_arg_allow_ref) + PHP_FE(is_null, NULL) + PHP_FE(is_resource, NULL) + PHP_FE(is_bool, NULL) + PHP_FE(is_long, NULL) + PHP_FALIAS(is_int, is_long, NULL) + PHP_FALIAS(is_integer, is_long, NULL) + PHP_FALIAS(is_float, is_double, NULL) + PHP_FE(is_double, NULL) + PHP_FALIAS(is_real, is_double, NULL) PHP_FE(is_numeric, NULL) - PHP_FE(is_string, first_arg_allow_ref) - PHP_FE(is_array, first_arg_allow_ref) - PHP_FE(is_object, first_arg_allow_ref) + PHP_FE(is_string, NULL) + PHP_FE(is_array, NULL) + PHP_FE(is_object, NULL) PHP_FE(is_scalar, NULL) - PHP_FE(is_callable, third_argument_force_ref) + PHP_FE(is_callable, third_arg_force_ref) PHP_FE(error_log, NULL) PHP_FE(call_user_func, NULL) @@ -358,8 +357,8 @@ function_entry basic_functions[] = { PHP_FE(call_user_method_array, second_arg_force_ref) PHP_FE(var_dump, NULL) - PHP_FE(serialize, first_arg_allow_ref) - PHP_FE(unserialize, first_arg_allow_ref) + PHP_FE(serialize, NULL) + PHP_FE(unserialize, NULL) PHP_FE(register_shutdown_function, NULL) @@ -391,9 +390,9 @@ function_entry basic_functions[] = { PHP_FE(move_uploaded_file, NULL) /* functions from reg.c */ - PHP_FE(ereg, third_argument_force_ref) + PHP_FE(ereg, third_arg_force_ref) PHP_FE(ereg_replace, NULL) - PHP_FE(eregi, third_argument_force_ref) + PHP_FE(eregi, third_arg_force_ref) PHP_FE(eregi_replace, NULL) PHP_FE(split, NULL) PHP_FE(spliti, NULL) @@ -563,7 +562,7 @@ function_entry basic_functions[] = { PHP_FE(uksort, first_arg_force_ref) PHP_FE(shuffle, first_arg_force_ref) PHP_FE(array_walk, first_arg_force_ref) - PHP_FE(count, first_arg_allow_ref) + PHP_FE(count, NULL) PHP_FE(end, first_arg_force_ref) PHP_FE(prev, first_arg_force_ref) PHP_FE(next, first_arg_force_ref) @@ -604,7 +603,7 @@ function_entry basic_functions[] = { /* aliases from array.c */ PHP_FALIAS(pos, current, first_arg_force_ref) - PHP_FALIAS(sizeof, count, first_arg_allow_ref) + PHP_FALIAS(sizeof, count, NULL) /* functions from assert.c */ PHP_FE(assert, NULL) diff --git a/ext/standard/dns.c b/ext/standard/dns.c index bf8fa2eb76..f3a4d71b8d 100644 --- a/ext/standard/dns.c +++ b/ext/standard/dns.c @@ -256,19 +256,11 @@ PHP_FUNCTION(getmxrr) if (zend_get_parameters(ht, 2, &host, &mx_list) == FAILURE) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 2)) { - php_error(E_WARNING, "Array to be filled with values must be passed by reference."); - RETURN_FALSE; - } break; case 3: if (zend_get_parameters(ht, 3, &host, &mx_list, &weight_list) == FAILURE) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 2) || !ParameterPassedByReference(ht, 3)) { - php_error(E_WARNING, "Array to be filled with values must be passed by reference."); - RETURN_FALSE; - } need_weight = 1; pval_destructor(weight_list); /* start with clean array */ if ( array_init(weight_list) == FAILURE ) { diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 7d538a4335..a669341890 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -251,18 +251,9 @@ PHP_FUNCTION(exec) ret = php_Exec(0, Z_STRVAL_PP(arg1), NULL,return_value); break; case 2: - if (!ParameterPassedByReference(ht,2)) { - php_error(E_WARNING,"Array argument to exec() not passed by reference"); - } ret = php_Exec(2, Z_STRVAL_PP(arg1),*arg2,return_value); break; case 3: - if (!ParameterPassedByReference(ht,2)) { - php_error(E_WARNING,"Array argument to exec() not passed by reference"); - } - if (!ParameterPassedByReference(ht,3)) { - php_error(E_WARNING,"return_status argument to exec() not passed by reference"); - } ret = php_Exec(2,Z_STRVAL_PP(arg1),*arg2,return_value); Z_TYPE_PP(arg3) = IS_LONG; Z_LVAL_PP(arg3)=ret; @@ -288,9 +279,6 @@ PHP_FUNCTION(system) ret = php_Exec(1, Z_STRVAL_PP(arg1), NULL,return_value); break; case 2: - if (!ParameterPassedByReference(ht,2)) { - php_error(E_WARNING,"return_status argument to system() not passed by reference"); - } ret = php_Exec(1, Z_STRVAL_PP(arg1), NULL,return_value); Z_TYPE_PP(arg2) = IS_LONG; Z_LVAL_PP(arg2)=ret; @@ -315,9 +303,6 @@ PHP_FUNCTION(passthru) ret = php_Exec(3, Z_STRVAL_PP(arg1), NULL,return_value); break; case 2: - if (!ParameterPassedByReference(ht,2)) { - php_error(E_WARNING,"return_status argument to system() not passed by reference"); - } ret = php_Exec(3, Z_STRVAL_PP(arg1), NULL,return_value); Z_TYPE_PP(arg2) = IS_LONG; Z_LVAL_PP(arg2)=ret; diff --git a/ext/standard/image.c b/ext/standard/image.c index 7b550f9519..6294cd60b2 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -422,11 +422,6 @@ PHP_FUNCTION(getimagesize) if (zend_get_parameters_ex(2, &arg1, &info) == FAILURE) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 2)) { - php_error(E_WARNING, "Array to be filled with values must be passed by reference."); - RETURN_FALSE; - } - zval_dtor(*info); if (array_init(*info) == FAILURE) { diff --git a/ext/standard/reg.c b/ext/standard/reg.c index 7116dad68a..63344b8878 100644 --- a/ext/standard/reg.c +++ b/ext/standard/reg.c @@ -194,10 +194,6 @@ static void php_ereg(INTERNAL_FUNCTION_PARAMETERS, int icase) if (zend_get_parameters_ex(3, ®ex, &findin, &array) == FAILURE) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 3)) { - php_error(E_WARNING, "Array to be filled with values must be passed by reference."); - RETURN_FALSE; - } break; default: WRONG_PARAM_COUNT; diff --git a/ext/yaz/php_yaz.c b/ext/yaz/php_yaz.c index 03daba8da2..3a42ce8632 100644 --- a/ext/yaz/php_yaz.c +++ b/ext/yaz/php_yaz.c @@ -2188,10 +2188,6 @@ PHP_FUNCTION(yaz_scan_result) { WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 2)) - { - WRONG_PARAM_COUNT; - } } else if (ZEND_NUM_ARGS() == 1) { @@ -2325,10 +2321,6 @@ PHP_FUNCTION(yaz_ccl_parse) WRONG_PARAM_COUNT; } - if (!ParameterPassedByReference(ht, 3)) { - php_error(E_WARNING, "Third argument must be passed by reference."); - RETURN_FALSE; - } pval_destructor(*pval_res); if (array_init(*pval_res) == FAILURE) {