Skip to content

Commit b44eee9

Browse files
committed
Add a string specialization
1 parent c0b70da commit b44eee9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/standard/array.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,13 @@ static inline bool php_in_array(const HashTable *ht, zval *value, bool strict)
16191619
return true;
16201620
}
16211621
} ZEND_HASH_FOREACH_END();
1622+
} else if (Z_TYPE_P(value) == IS_STRING) {
1623+
ZEND_HASH_FOREACH_VAL(ht, /* const */ zval *entry) {
1624+
ZVAL_DEREF(entry);
1625+
if (Z_TYPE_P(entry) == IS_STRING && zend_string_equals(Z_STR_P(value), Z_STR_P(entry))) {
1626+
return true;
1627+
}
1628+
} ZEND_HASH_FOREACH_END();
16221629
} else {
16231630
ZEND_HASH_FOREACH_VAL(ht, /* const */ zval *entry) {
16241631
ZVAL_DEREF(entry);

0 commit comments

Comments
 (0)