diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2018-05-28 00:48:35 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2018-05-28 00:48:35 +0200 |
commit | 97a84831432a9b727235ee4727905919681aeac4 (patch) | |
tree | d04ea1799e513a99a24e522e52023b72491bdf22 | |
parent | 34fb42970a40673e17778ae06fdab751046ccf1d (diff) | |
download | php-git-97a84831432a9b727235ee4727905919681aeac4.tar.gz |
Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | Zend/tests/bug76383.phpt | 13 | ||||
-rw-r--r-- | ext/standard/array.c | 2 |
3 files changed, 15 insertions, 1 deletions
@@ -18,6 +18,7 @@ PHP NEWS - Standard: . Fixed bug #76335 ("link(): Bad file descriptor" with non-ASCII path). (Anatol) + . Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT). (Bob) 24 May 2018, PHP 7.1.18 diff --git a/Zend/tests/bug76383.phpt b/Zend/tests/bug76383.phpt new file mode 100644 index 0000000000..ae26ba8acd --- /dev/null +++ b/Zend/tests/bug76383.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #76383: array_map on $GLOBALS returns IS_INDIRECT +--FILE-- +<?php + +$a = 1; +array_map(function($x) use (&$lastval) { $lastval = $x; }, $GLOBALS); +var_dump(gettype($lastval), $lastval); // will contain $a + +?> +--EXPECT-- +string(7) "integer" +int(1) diff --git a/ext/standard/array.c b/ext/standard/array.c index 970735cf47..5905ae4929 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -5348,7 +5348,7 @@ PHP_FUNCTION(array_map) array_init_size(return_value, maxlen); - ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(arrays[0]), num_key, str_key, zv) { + ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL(arrays[0]), num_key, str_key, zv) { fci.retval = &result; fci.param_count = 1; fci.params = &arg; |