File tree Expand file tree Collapse file tree 1 file changed +30
-12
lines changed Expand file tree Collapse file tree 1 file changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -1543,21 +1543,39 @@ static inline void php_search_array(INTERNAL_FUNCTION_PARAMETERS, int behavior)
1543
1543
ZEND_PARSE_PARAMETERS_END ();
1544
1544
1545
1545
if (strict ) {
1546
- ZEND_HASH_FOREACH_KEY_VAL (Z_ARRVAL_P (array ), num_idx , str_idx , entry ) {
1547
- ZVAL_DEREF (entry );
1548
- if (fast_is_identical_function (value , entry )) {
1549
- if (behavior == 0 ) {
1550
- RETURN_TRUE ;
1551
- } else {
1552
- if (str_idx ) {
1553
- RETVAL_STR_COPY (str_idx );
1546
+ if (Z_TYPE_P (value ) == IS_LONG ) {
1547
+ ZEND_HASH_FOREACH_KEY_VAL (Z_ARRVAL_P (array ), num_idx , str_idx , entry ) {
1548
+ ZVAL_DEREF (entry );
1549
+ if (Z_TYPE_P (entry ) == IS_LONG && Z_LVAL_P (entry ) == Z_LVAL_P (value )) {
1550
+ if (behavior == 0 ) {
1551
+ RETURN_TRUE ;
1554
1552
} else {
1555
- RETVAL_LONG (num_idx );
1553
+ if (str_idx ) {
1554
+ RETVAL_STR_COPY (str_idx );
1555
+ } else {
1556
+ RETVAL_LONG (num_idx );
1557
+ }
1558
+ return ;
1556
1559
}
1557
- return ;
1558
1560
}
1559
- }
1560
- } ZEND_HASH_FOREACH_END ();
1561
+ } ZEND_HASH_FOREACH_END ();
1562
+ } else {
1563
+ ZEND_HASH_FOREACH_KEY_VAL (Z_ARRVAL_P (array ), num_idx , str_idx , entry ) {
1564
+ ZVAL_DEREF (entry );
1565
+ if (fast_is_identical_function (value , entry )) {
1566
+ if (behavior == 0 ) {
1567
+ RETURN_TRUE ;
1568
+ } else {
1569
+ if (str_idx ) {
1570
+ RETVAL_STR_COPY (str_idx );
1571
+ } else {
1572
+ RETVAL_LONG (num_idx );
1573
+ }
1574
+ return ;
1575
+ }
1576
+ }
1577
+ } ZEND_HASH_FOREACH_END ();
1578
+ }
1561
1579
} else {
1562
1580
if (Z_TYPE_P (value ) == IS_LONG ) {
1563
1581
ZEND_HASH_FOREACH_KEY_VAL (Z_ARRVAL_P (array ), num_idx , str_idx , entry ) {
You can’t perform that action at this time.
0 commit comments