com php-src: Make current() and key() receive argument by value.: ext/standard/array.c ext/standard/basic_functions.c ext/s
tandard/tests/array/009.phpt
| From: | Dmitry Stogov | Date: | Tue, 24 Feb 2015 14:40:25 +0000 |
| Subject: | com php-src: Make current() and key() receive argument by value.: ext/standard/array.c ext/standard/basic_functions.c ext/s tandard/tests/array/009.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85069@lists.php.net to get a copy of this message | ||
Commit: 745504ea2a7066588af9714f5e32523a3fff4db7
Author: Dmitry Stogov <dmitry@zend.com> Tue, 24 Feb 2015 17:40:25 +0300
Parents: 3e6380d64bffab0c3efad81236b84d89cf743511
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=745504ea2a7066588af9714f5e32523a3fff4db7
Log:
Make current() and key() receive argument by value.
Changed paths:
M ext/standard/array.c
M ext/standard/basic_functions.c
M ext/standard/tests/array/009.phpt
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 701e10d..c63cadd 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 e11b54c..4e1ea31 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 8fa51d5..e0618ad 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