com php-src: Fix array_keys() on $GLOBALS: ext/ standard/array.c ext/standard/tests/array/array_keys_on _GLOBALS.phpt
| From: | Nikita Popov | Date: | Thu, 16 Oct 2014 12:44:35 +0000 |
| Subject: | com php-src: Fix array_keys() on $GLOBALS: ext/ standard/array.c ext/standard/tests/array/array_keys_on _GLOBALS.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82377@lists.php.net to get a copy of this message | ||
Commit: fc6ce7d1c1852385b35b3a41feb4c47d9e1ce945
Author: Nikita Popov <nikic@php.net> Thu, 16 Oct 2014 14:44:35 +0200
Parents: cf5920e8aa8958d47f391c483d7399fc77a58092
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc6ce7d1c1852385b35b3a41feb4c47d9e1ce945
Log:
Fix array_keys() on $GLOBALS
Changed paths:
M ext/standard/array.c
A ext/standard/tests/array/array_keys_on_GLOBALS.phpt
Diff:
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 7b49b2f..7d8e4d0 100644
--- a/ext/standard/array..c
+++ b/ext/standard/array.c
@@ -2597,7 +2597,7 @@ PHP_FUNCTION(array_keys)
add_key = 1;
/* Go through input array and add keys to the return array */
- ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(input), num_idx, str_idx, entry) {
if (search_value != NULL) {
is_equal_func(&res, search_value, entry TSRMLS_CC);
add_key = zval_is_true(&res);
diff --git a/ext/standard/tests/array/array_keys_on_GLOBALS.phpt
b/ext/standard/tests/array/array_keys_on_GLOBALS.phpt
new file mode 100644
index 0000000..1d14ff4
--- /dev/null
+++ b/ext/standard/tests/array/array_keys_on_GLOBALS.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Using array_keys() on $GLOBALS
+--FILE--
+<?php
+
+$foo = 'bar';
+unset($foo);
+var_dump(in_array('foo', array_keys($GLOBALS)));
+
+?>
+--EXPECT--
+bool(false)