]> granicus.if.org Git - php/commitdiff
Introduce zend_symtable_exists_ind() for API consistency
authorDmitry Stogov <dmitry@zend.com>
Wed, 2 Mar 2016 08:53:47 +0000 (11:53 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 2 Mar 2016 08:53:47 +0000 (11:53 +0300)
Zend/zend_hash.h
ext/standard/array.c

index e90763ce8ce6cc51d71f32624f00ff150b7532f6..f4c2c30fbcae0427e56f55b8cf241352c5a8c75f 100644 (file)
@@ -377,6 +377,18 @@ static zend_always_inline int zend_symtable_exists(HashTable *ht, zend_string *k
 {
        zend_ulong idx;
 
+       if (ZEND_HANDLE_NUMERIC(key, idx)) {
+               return zend_hash_index_exists(ht, idx);
+       } else {
+               return zend_hash_exists(ht, key);
+       }
+}
+
+
+static zend_always_inline int zend_symtable_exists_ind(HashTable *ht, zend_string *key)
+{
+       zend_ulong idx;
+
        if (ZEND_HANDLE_NUMERIC(key, idx)) {
                return zend_hash_index_exists(ht, idx);
        } else {
index def7d7c465b0d3ab15797af5be2da641d3977812..4d2c45ec51a97f9b6eb93931ab319ed34adb4ff4 100644 (file)
@@ -5429,7 +5429,7 @@ PHP_FUNCTION(array_key_exists)
 
        switch (Z_TYPE_P(key)) {
                case IS_STRING:
-                       if (zend_symtable_exists(array, Z_STR_P(key))) {
+                       if (zend_symtable_exists_ind(array, Z_STR_P(key))) {
                                RETURN_TRUE;
                        }
                        RETURN_FALSE;
@@ -5439,7 +5439,7 @@ PHP_FUNCTION(array_key_exists)
                        }
                        RETURN_FALSE;
                case IS_NULL:
-                       if (zend_hash_exists(array, ZSTR_EMPTY_ALLOC())) {
+                       if (zend_hash_exists_ind(array, ZSTR_EMPTY_ALLOC())) {
                                RETURN_TRUE;
                        }
                        RETURN_FALSE;