From: Dmitry Stogov Date: Tue, 24 Feb 2015 14:40:25 +0000 (+0300) Subject: Make current() and key() receive argument by value. X-Git-Tag: PRE_PHP7_EREG_MYSQL_REMOVALS~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=745504ea2a7066588af9714f5e32523a3fff4db7;p=php Make current() and key() receive argument by value. --- diff --git a/ext/standard/array.c b/ext/standard/array.c index 701e10dff2..c63caddda8 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -925,12 +925,12 @@ PHP_FUNCTION(current) zval *entry; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS(), "H/", &array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "H", &array) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1) + Z_PARAM_ARRAY_OR_OBJECT_HT(array) ZEND_PARSE_PARAMETERS_END(); #endif @@ -953,12 +953,12 @@ PHP_FUNCTION(key) HashTable *array; #ifndef FAST_ZPP - if (zend_parse_parameters(ZEND_NUM_ARGS(), "H/", &array) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "H", &array) == FAILURE) { return; } #else ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_ARRAY_OR_OBJECT_HT_EX(array, 0, 1) + Z_PARAM_ARRAY_OR_OBJECT_HT(array) ZEND_PARSE_PARAMETERS_END(); #endif diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index e11b54cf23..4e1ea31294 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -289,11 +289,11 @@ ZEND_BEGIN_ARG_INFO(arginfo_reset, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_current, 0) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) + ZEND_ARG_INFO(0, arg) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO(arginfo_key, 0) - ZEND_ARG_INFO(ZEND_SEND_PREFER_REF, arg) + ZEND_ARG_INFO(0, arg) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_min, 0, 0, 1) diff --git a/ext/standard/tests/array/009.phpt b/ext/standard/tests/array/009.phpt index 8fa51d51ca..e0618ad70e 100644 --- a/ext/standard/tests/array/009.phpt +++ b/ext/standard/tests/array/009.phpt @@ -459,9 +459,13 @@ array(5) { -- Testing variation: when array is unset -- +Notice: Undefined variable: unset_array in %s on line %d + Warning: current() expects parameter 1 to be array, null given in %s on line %d NULL +Notice: Undefined variable: unset_array in %s on line %d + Warning: key() expects parameter 1 to be array, null given in %s on line %d NULL