mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
parent
d317e16e89
commit
5fa6dcd972
2
NEWS
2
NEWS
@ -2,6 +2,8 @@ PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2019, PHP 7.2.26
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
|
||||
|
||||
21 Nov 2019, PHP 7.2.25
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
if (strict) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
ZVAL_DEREF(entry);
|
||||
if (fast_is_identical_function(value, entry)) {
|
||||
if (behavior == 0) {
|
||||
@ -1595,7 +1595,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} else {
|
||||
if (Z_TYPE_P(value) == IS_LONG) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
if (fast_equal_check_long(value, entry)) {
|
||||
if (behavior == 0) {
|
||||
RETURN_TRUE;
|
||||
@ -1610,7 +1610,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} else if (Z_TYPE_P(value) == IS_STRING) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
if (fast_equal_check_string(value, entry)) {
|
||||
if (behavior == 0) {
|
||||
RETURN_TRUE;
|
||||
@ -1625,7 +1625,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} else {
|
||||
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
|
||||
if (fast_equal_check_function(value, entry)) {
|
||||
if (behavior == 0) {
|
||||
RETURN_TRUE;
|
||||
|
15
ext/standard/tests/array/bug78759.phpt
Normal file
15
ext/standard/tests/array/bug78759.phpt
Normal file
@ -0,0 +1,15 @@
|
||||
--TEST--
|
||||
Bug #78759: array_search in $GLOBALS
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$a = 22;
|
||||
var_dump($GLOBALS["a"]); // int 22
|
||||
var_dump(array_search(22, $GLOBALS)); // false
|
||||
var_dump(array_search(22, $GLOBALS, true)); // false
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(22)
|
||||
string(1) "a"
|
||||
string(1) "a"
|
Loading…
Reference in New Issue
Block a user