Skip to content

Commit aed4f6e

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fixed bug #78759
2 parents 0988f69 + 8d2a9d8 commit aed4f6e

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PHP NEWS
99
- Standard:
1010
. Fixed bug #77930 (stream_copy_to_stream should use mmap more often).
1111
(Nikita)
12+
. Fixed bug #78759 (array_search in $GLOBALS). (Nikita)
1213

1314
- OpenSSL:
1415
. Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted

ext/standard/array.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
15581558

15591559
if (strict) {
15601560
if (Z_TYPE_P(value) == IS_LONG) {
1561-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
1561+
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
15621562
ZVAL_DEREF(entry);
15631563
if (Z_TYPE_P(entry) == IS_LONG && Z_LVAL_P(entry) == Z_LVAL_P(value)) {
15641564
if (behavior == 0) {
@@ -1574,7 +1574,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
15741574
}
15751575
} ZEND_HASH_FOREACH_END();
15761576
} else {
1577-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
1577+
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
15781578
ZVAL_DEREF(entry);
15791579
if (fast_is_identical_function(value, entry)) {
15801580
if (behavior == 0) {
@@ -1592,7 +1592,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
15921592
}
15931593
} else {
15941594
if (Z_TYPE_P(value) == IS_LONG) {
1595-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
1595+
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
15961596
if (fast_equal_check_long(value, entry)) {
15971597
if (behavior == 0) {
15981598
RETURN_TRUE;
@@ -1607,7 +1607,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
16071607
}
16081608
} ZEND_HASH_FOREACH_END();
16091609
} else if (Z_TYPE_P(value) == IS_STRING) {
1610-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
1610+
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
16111611
if (fast_equal_check_string(value, entry)) {
16121612
if (behavior == 0) {
16131613
RETURN_TRUE;
@@ -1622,7 +1622,7 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
16221622
}
16231623
} ZEND_HASH_FOREACH_END();
16241624
} else {
1625-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
1625+
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(array), num_idx, str_idx, entry) {
16261626
if (fast_equal_check_function(value, entry)) {
16271627
if (behavior == 0) {
16281628
RETURN_TRUE;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Bug #78759: array_search in $GLOBALS
3+
--FILE--
4+
<?php
5+
6+
$a = 22;
7+
var_dump($GLOBALS["a"]); // int 22
8+
var_dump(array_search(22, $GLOBALS)); // false
9+
var_dump(array_search(22, $GLOBALS, true)); // false
10+
11+
?>
12+
--EXPECT--
13+
int(22)
14+
string(1) "a"
15+
string(1) "a"

0 commit comments

Comments
 (0)