Skip to content

Commit c0b70da

Browse files
committed
Re-add int specialization
1 parent abc7780 commit c0b70da

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

ext/standard/array.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,12 +1612,21 @@ PHP_FUNCTION(array_search)
16121612
static inline bool php_in_array(const HashTable *ht, zval *value, bool strict)
16131613
{
16141614
if (strict) {
1615-
ZEND_HASH_FOREACH_VAL(ht, /* const */ zval *entry) {
1616-
ZVAL_DEREF(entry);
1617-
if (fast_is_identical_function(value, entry)) {
1618-
return true;
1619-
}
1620-
} ZEND_HASH_FOREACH_END();
1615+
if (Z_TYPE_P(value) == IS_LONG) {
1616+
ZEND_HASH_FOREACH_VAL(ht, /* const */ zval *entry) {
1617+
ZVAL_DEREF(entry);
1618+
if (Z_TYPE_P(entry) == IS_LONG && Z_LVAL_P(entry) == Z_LVAL_P(value)) {
1619+
return true;
1620+
}
1621+
} ZEND_HASH_FOREACH_END();
1622+
} else {
1623+
ZEND_HASH_FOREACH_VAL(ht, /* const */ zval *entry) {
1624+
ZVAL_DEREF(entry);
1625+
if (fast_is_identical_function(value, entry)) {
1626+
return true;
1627+
}
1628+
} ZEND_HASH_FOREACH_END();
1629+
}
16211630
} else {
16221631
ZEND_HASH_FOREACH_VAL(ht, /* const */ zval *entry) {
16231632
ZVAL_DEREF(entry);

0 commit comments

Comments
 (0)