]> granicus.if.org Git - php/commitdiff
Introduced zend_hash_find_ex() that may avoid unnecessary hash value check.
authorDmitry Stogov <dmitry@zend.com>
Fri, 24 Nov 2017 11:01:19 +0000 (14:01 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 24 Nov 2017 11:01:19 +0000 (14:01 +0300)
Zend/zend_execute.c
Zend/zend_execute_API.c
Zend/zend_hash.c
Zend/zend_hash.h
Zend/zend_inheritance.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 51ad74f4f2a9854c4b2f98f32cd9412cef0fd569..2025eb361975970dfe2979746839e1e75fb8438b 100644 (file)
@@ -1503,7 +1503,7 @@ num_undef:
                        }
                }
 str_index:
-               retval = zend_hash_find(ht, offset_key);
+               retval = zend_hash_find_ex(ht, offset_key, dim_type == IS_CONST);
                if (retval) {
                        /* support for $GLOBALS[...] */
                        if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
@@ -1896,7 +1896,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
                                }
                                zobj->properties = zend_array_dup(zobj->properties);
                        }
-                       retval = zend_hash_find(zobj->properties, Z_STR_P(prop_ptr));
+                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(prop_ptr), 1);
                        if (EXPECTED(retval)) {
                                ZVAL_INDIRECT(result, retval);
                                return;
index 8ffeaf0b5c3a5cffe7933bc460873438dc9284ed..04174d46b2fdf9c03bb744cb7e9e3dcc30da786f 100644 (file)
@@ -1536,7 +1536,7 @@ ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data) /* {{{ *
                zval *var = EX_VAR_NUM(0);
 
                do {
-                       zval *zv = zend_hash_find(ht, *str);
+                       zval *zv = zend_hash_find_ex(ht, *str, 1);
 
                        if (zv) {
                                if (Z_TYPE_P(zv) == IS_INDIRECT) {
index 5936b922dc4605811d94adab85c34d82659138de..08dd56ff274bccfe5cabdf9e10284c7dfc503c70 100644 (file)
@@ -465,14 +465,18 @@ ZEND_API void ZEND_FASTCALL _zend_hash_iterators_update(HashTable *ht, HashPosit
        }
 }
 
-static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zend_string *key)
+static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zend_string *key, zend_bool known_hash)
 {
        zend_ulong h;
        uint32_t nIndex;
        uint32_t idx;
        Bucket *p, *arData;
 
-       h = zend_string_hash_val(key);
+       if (known_hash) {
+               h = ZSTR_H(key);
+       } else {
+               h = zend_string_hash_val(key);
+       }
        arData = ht->arData;
        nIndex = h | ht->nTableMask;
        idx = HT_HASH_EX(arData, nIndex);
@@ -560,7 +564,7 @@ static zend_always_inline zval *_zend_hash_add_or_update_i(HashTable *ht, zend_s
                        zend_string_hash_val(key);
                }
        } else if ((flag & HASH_ADD_NEW) == 0) {
-               p = zend_hash_find_bucket(ht, key);
+               p = zend_hash_find_bucket(ht, key, 0);
 
                if (p) {
                        zval *data;
@@ -2019,7 +2023,17 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *ke
 
        IS_CONSISTENT(ht);
 
-       p = zend_hash_find_bucket(ht, key);
+       p = zend_hash_find_bucket(ht, key, 0);
+       return p ? &p->val : NULL;
+}
+
+ZEND_API zval* ZEND_FASTCALL _zend_hash_find_known_hash(const HashTable *ht, zend_string *key)
+{
+       Bucket *p;
+
+       IS_CONSISTENT(ht);
+
+       p = zend_hash_find_bucket(ht, key, 1);
        return p ? &p->val : NULL;
 }
 
@@ -2041,7 +2055,7 @@ ZEND_API zend_bool ZEND_FASTCALL zend_hash_exists(const HashTable *ht, zend_stri
 
        IS_CONSISTENT(ht);
 
-       p = zend_hash_find_bucket(ht, key);
+       p = zend_hash_find_bucket(ht, key, 0);
        return p ? 1 : 0;
 }
 
index def2fe576d4c6aa061bda8a6d7e3d70b449bffcd..852ec1c56af214a2ac6fe3cf4748cd752030d29c 100644 (file)
@@ -179,6 +179,18 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char
 ZEND_API zval* ZEND_FASTCALL zend_hash_index_find(const HashTable *ht, zend_ulong h);
 ZEND_API zval* ZEND_FASTCALL _zend_hash_index_find(const HashTable *ht, zend_ulong h);
 
+/* The same as zend_hash_find(), but hash value of the key must be already calculated */
+ZEND_API zval* ZEND_FASTCALL _zend_hash_find_known_hash(const HashTable *ht, zend_string *key);
+
+static zend_always_inline zval *zend_hash_find_ex(const HashTable *ht, zend_string *key, zend_bool known_hash)
+{
+       if (known_hash) {
+               return _zend_hash_find_known_hash(ht, key);
+       } else {
+               return zend_hash_find(ht, key);
+       }
+}
+
 #define ZEND_HASH_INDEX_FIND(_ht, _h, _ret, _not_found) do { \
                if (EXPECTED((_ht)->u.flags & HASH_FLAG_PACKED)) { \
                        if (EXPECTED((zend_ulong)(_h) < (zend_ulong)(_ht)->nNumUsed)) { \
@@ -330,6 +342,16 @@ static zend_always_inline zval *zend_hash_find_ind(const HashTable *ht, zend_str
 }
 
 
+static zend_always_inline zval *zend_hash_find_ex_ind(const HashTable *ht, zend_string *key, zend_bool known_hash)
+{
+       zval *zv;
+
+       zv = zend_hash_find_ex(ht, key, known_hash);
+       return (zv && Z_TYPE_P(zv) == IS_INDIRECT) ?
+               ((Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF) ? Z_INDIRECT_P(zv) : NULL) : zv;
+}
+
+
 static zend_always_inline int zend_hash_exists_ind(const HashTable *ht, zend_string *key)
 {
        zval *zv;
index 7f253d90eac11e5a04d7ed403f881dd9ea459583..00d0a9ac33746c46fd8c8844dc66ef37d65117ed 100644 (file)
@@ -633,7 +633,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
 
 static zend_function *do_inherit_method(zend_string *key, zend_function *parent, zend_class_entry *ce) /* {{{ */
 {
-       zval *child = zend_hash_find(&ce->function_table, key);
+       zval *child = zend_hash_find_ex(&ce->function_table, key, 1);
 
        if (child) {
                zend_function *func = (zend_function*)Z_PTR_P(child);
@@ -663,7 +663,7 @@ static zend_function *do_inherit_method(zend_string *key, zend_function *parent,
 
 static void do_inherit_property(zend_property_info *parent_info, zend_string *key, zend_class_entry *ce) /* {{{ */
 {
-       zval *child = zend_hash_find(&ce->properties_info, key);
+       zval *child = zend_hash_find_ex(&ce->properties_info, key, 1);
        zend_property_info *child_info;
 
        if (UNEXPECTED(child)) {
@@ -765,9 +765,11 @@ ZEND_API void zend_do_inherit_interfaces(zend_class_entry *ce, const zend_class_
 
 static void do_inherit_class_constant(zend_string *name, zend_class_constant *parent_const, zend_class_entry *ce) /* {{{ */
 {
-       zend_class_constant *c = zend_hash_find_ptr(&ce->constants_table, name);
+       zval *zv = zend_hash_find_ex(&ce->constants_table, name, 1);
+       zend_class_constant *c;
 
-       if (c != NULL) {
+       if (zv != NULL) {
+               c = (zend_class_constant*)Z_PTR_P(zv);
                if (UNEXPECTED((Z_ACCESS_FLAGS(c->value) & ZEND_ACC_PPP_MASK) > (Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PPP_MASK))) {
                        zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s must be %s (as in class %s)%s",
                                ZSTR_VAL(ce->name), ZSTR_VAL(name), zend_visibility_string(Z_ACCESS_FLAGS(parent_const->value)), ZSTR_VAL(ce->parent->name), (Z_ACCESS_FLAGS(parent_const->value) & ZEND_ACC_PUBLIC) ? "" : " or weaker");
@@ -990,9 +992,11 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
 
 static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zend_class_constant *parent_constant, zend_string *name, const zend_class_entry *iface) /* {{{ */
 {
+       zval *zv = zend_hash_find_ex(child_constants_table, name, 1);
        zend_class_constant *old_constant;
 
-       if ((old_constant = zend_hash_find_ptr(child_constants_table, name)) != NULL) {
+       if (zv != NULL) {
+               old_constant = (zend_class_constant*)Z_PTR_P(zv);
                if (old_constant->ce != parent_constant->ce) {
                        zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", ZSTR_VAL(name), ZSTR_VAL(iface->name));
                }
index 88db654015bb3d5a9dc75297ec6312f54c39ebbb..8d5a72a904a3f15ca897a1bea17db8543876d629 100644 (file)
@@ -1398,7 +1398,7 @@ ZEND_VM_HELPER(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED, int type)
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       retval = zend_hash_find(target_symbol_table, name);
+       retval = zend_hash_find_ex(target_symbol_table, name, OP1_TYPE == IS_CONST);
        if (retval == NULL) {
                if (UNEXPECTED(zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS)))) {
                        zval *result;
@@ -1820,7 +1820,7 @@ ZEND_VM_HANDLER(82, ZEND_FETCH_OBJ_R, CONST|TMP|VAR|UNUSED|THIS|CV, CONST|TMPVAR
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -1968,7 +1968,7 @@ ZEND_VM_HANDLER(91, ZEND_FETCH_OBJ_IS, CONST|TMPVAR|UNUSED|THIS|CV, CONST|TMPVAR
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -2152,7 +2152,7 @@ ZEND_VM_C_LABEL(fast_assign_obj):
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        ZEND_VM_C_GOTO(fast_assign_obj);
                                }
@@ -3298,7 +3298,7 @@ ZEND_VM_HOT_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST, NUM)
        function_name = (zval*)RT_CONSTANT(opline, opline->op2);
        fbc = CACHED_PTR(Z_CACHE_SLOT_P(function_name));
        if (UNEXPECTED(fbc == NULL)) {
-               func = zend_hash_find(EG(function_table), Z_STR_P(function_name+1));
+               func = zend_hash_find_ex(EG(function_table), Z_STR_P(function_name+1), 1);
                if (UNEXPECTED(func == NULL)) {
                        SAVE_OPLINE();
                        zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(function_name));
@@ -3463,10 +3463,10 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM)
        func_name = RT_CONSTANT(opline, opline->op2) + 1;
        fbc = CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(opline, opline->op2)));
        if (UNEXPECTED(fbc == NULL)) {
-               func = zend_hash_find(EG(function_table), Z_STR_P(func_name));
+               func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
                if (func == NULL) {
                        func_name++;
-                       func = zend_hash_find(EG(function_table), Z_STR_P(func_name));
+                       func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
                        if (UNEXPECTED(func == NULL)) {
                                SAVE_OPLINE();
                                zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
@@ -3499,7 +3499,7 @@ ZEND_VM_HOT_HANDLER(61, ZEND_INIT_FCALL, NUM, CONST, NUM)
 
        fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
        if (UNEXPECTED(fbc == NULL)) {
-               func = zend_hash_find(EG(function_table), Z_STR_P(fname));
+               func = zend_hash_find_ex(EG(function_table), Z_STR_P(fname), 1);
                if (UNEXPECTED(func == NULL)) {
                    SAVE_OPLINE();
                        zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(fname));
@@ -5083,7 +5083,7 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
 {
        zend_class_entry *ce, *scope;
        zend_class_constant *c;
-       zval *value;
+       zval *value, *zv;
        USE_OPLINE
 
        SAVE_OPLINE();
@@ -5121,7 +5121,9 @@ ZEND_VM_HANDLER(181, ZEND_FETCH_CLASS_CONSTANT, VAR|CONST|UNUSED|CLASS_FETCH, CO
                        }
                }
 
-               if (EXPECTED((c = zend_hash_find_ptr(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)))) != NULL)) {
+               zv = zend_hash_find_ex(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)), 1);
+               if (EXPECTED(zv != NULL)) {
+                       c = Z_PTR_P(zv);
                        scope = EX(func)->op_array.scope;
                        if (!zend_verify_const_access(c, scope)) {
                                zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
@@ -6278,7 +6280,7 @@ ZEND_VM_HANDLER(114, ZEND_ISSET_ISEMPTY_VAR, CONST|TMPVAR|CV, UNUSED, VAR_FETCH|
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       value = zend_hash_find_ind(target_symbol_table, name);
+       value = zend_hash_find_ex_ind(target_symbol_table, name, OP1_TYPE == IS_CONST);
 
        if (OP1_TYPE != IS_CONST) {
                zend_tmp_string_release(tmp_name);
@@ -6416,7 +6418,7 @@ ZEND_VM_C_LABEL(isset_again):
                                }
                        }
 ZEND_VM_C_LABEL(str_index_prop):
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, OP2_TYPE == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 ZEND_VM_C_LABEL(num_index_prop):
@@ -6605,9 +6607,9 @@ ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
                do {
                        EG(error_reporting) = 0;
                        if (!EG(error_reporting_ini_entry)) {
-                               zend_ini_entry *p = zend_hash_find_ptr(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING));
-                               if (p) {
-                                       EG(error_reporting_ini_entry) = p;
+                               zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
+                               if (zv) {
+                                       EG(error_reporting_ini_entry) = (zend_ini_entry *)Z_PTR_P(zv);
                                } else {
                                        break;
                                }
@@ -6830,8 +6832,8 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, VAR)
        zval *zce, *orig_zce;
 
        SAVE_OPLINE();
-       if ((zce = zend_hash_find(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)))) == NULL ||
-           ((orig_zce = zend_hash_find(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)+1))) != NULL &&
+       if ((zce = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1)) == NULL ||
+           ((orig_zce = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)+1), 1)) != NULL &&
             Z_CE_P(zce) != Z_CE_P(orig_zce))) {
                do_bind_inherited_class(&EX(func)->op_array, opline, EG(class_table), Z_CE_P(EX_VAR(opline->op2.var)), 0);
        }
@@ -6840,13 +6842,15 @@ ZEND_VM_HANDLER(145, ZEND_DECLARE_INHERITED_CLASS_DELAYED, ANY, VAR)
 
 ZEND_VM_HANDLER(171, ZEND_DECLARE_ANON_CLASS, ANY, ANY, JMP_ADDR)
 {
+       zval *zv;
        zend_class_entry *ce;
        USE_OPLINE
 
        SAVE_OPLINE();
-       ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)));
+       zv = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
+       ZEND_ASSERT(zv != NULL);
+       ce = Z_CE_P(zv);
        Z_CE_P(EX_VAR(opline->result.var)) = ce;
-       ZEND_ASSERT(ce != NULL);
 
        if (ce->ce_flags & ZEND_ACC_ANON_BOUND) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
@@ -6862,13 +6866,15 @@ ZEND_VM_HANDLER(171, ZEND_DECLARE_ANON_CLASS, ANY, ANY, JMP_ADDR)
 
 ZEND_VM_HANDLER(172, ZEND_DECLARE_ANON_INHERITED_CLASS, ANY, VAR, JMP_ADDR)
 {
+       zval *zv;
        zend_class_entry *ce;
        USE_OPLINE
 
        SAVE_OPLINE();
-       ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)));
+       zv = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
+       ZEND_ASSERT(zv != NULL);
+       ce = Z_CE_P(zv);
        Z_CE_P(EX_VAR(opline->result.var)) = ce;
-       ZEND_ASSERT(ce != NULL);
 
        if (ce->ce_flags & ZEND_ACC_ANON_BOUND) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
@@ -7223,7 +7229,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
        zval *object;
        zend_class_entry *called_scope;
 
-       zfunc = zend_hash_find(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)));
+       zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
        ZEND_ASSERT(zfunc != NULL && Z_FUNC_P(zfunc)->type == ZEND_USER_FUNCTION);
 
        if (Z_TYPE(EX(This)) == IS_OBJECT) {
@@ -7591,7 +7597,7 @@ ZEND_VM_HOT_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST)
                }
        }
 
-       value = zend_hash_find(&EG(symbol_table), Z_STR_P(varname));
+       value = zend_hash_find_ex(&EG(symbol_table), Z_STR_P(varname), 1);
        if (UNEXPECTED(value == NULL)) {
                value = zend_hash_add_new(&EG(symbol_table), Z_STR_P(varname), &EG(uninitialized_zval));
                idx = (char*)value - (char*)EG(symbol_table).arData;
@@ -7994,7 +8000,7 @@ ZEND_VM_HANDLER(183, ZEND_BIND_STATIC, CV, CONST, REF)
        }
 
        varname = GET_OP2_ZVAL_PTR(BP_VAR_R);
-       value = zend_hash_find(ht, Z_STR_P(varname));
+       value = zend_hash_find_ex(ht, Z_STR_P(varname), 1);
 
        if (opline->extended_value) {
                if (Z_TYPE_P(value) == IS_CONSTANT_AST) {
@@ -8130,14 +8136,19 @@ ZEND_VM_HANDLER(188, ZEND_SWITCH_STRING, CONST|TMPVAR|CV, CONST, JMP_ADDR)
        jumptable = Z_ARRVAL_P(GET_OP2_ZVAL_PTR(BP_VAR_R));
 
        if (Z_TYPE_P(op) != IS_STRING) {
-               ZVAL_DEREF(op);
-               if (Z_TYPE_P(op) != IS_STRING) {
+               if (OP1_TYPE == IS_CONST) {
                        /* Wrong type, fall back to ZEND_CASE chain */
                        ZEND_VM_NEXT_OPCODE();
+               } else {
+                       ZVAL_DEREF(op);
+                       if (Z_TYPE_P(op) != IS_STRING) {
+                               /* Wrong type, fall back to ZEND_CASE chain */
+                               ZEND_VM_NEXT_OPCODE();
+                       }
                }
        }
 
-       jump_zv = zend_hash_find(jumptable, Z_STR_P(op));
+       jump_zv = zend_hash_find_ex(jumptable, Z_STR_P(op), OP1_TYPE == IS_CONST);
        if (jump_zv != NULL) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, Z_LVAL_P(jump_zv));
                ZEND_VM_CONTINUE();
index e9dcc536e8e1f1f2edf9851c72e4d5ae1927fdb9..52c2b6b383a1f56a96d72eaf5a0d1bf1b26a9828 100644 (file)
@@ -1517,9 +1517,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEN
                do {
                        EG(error_reporting) = 0;
                        if (!EG(error_reporting_ini_entry)) {
-                               zend_ini_entry *p = zend_hash_find_ptr(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING));
-                               if (p) {
-                                       EG(error_reporting_ini_entry) = p;
+                               zval *zv = zend_hash_find_ex(EG(ini_directives), ZSTR_KNOWN(ZEND_STR_ERROR_REPORTING), 1);
+                               if (zv) {
+                                       EG(error_reporting_ini_entry) = (zend_ini_entry *)Z_PTR_P(zv);
                                } else {
                                        break;
                                }
@@ -1587,13 +1587,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEN
 
 static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
+       zval *zv;
        zend_class_entry *ce;
        USE_OPLINE
 
        SAVE_OPLINE();
-       ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)));
+       zv = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
+       ZEND_ASSERT(zv != NULL);
+       ce = Z_CE_P(zv);
        Z_CE_P(EX_VAR(opline->result.var)) = ce;
-       ZEND_ASSERT(ce != NULL);
 
        if (ce->ce_flags & ZEND_ACC_ANON_BOUND) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
@@ -2143,7 +2145,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME
        function_name = (zval*)RT_CONSTANT(opline, opline->op2);
        fbc = CACHED_PTR(Z_CACHE_SLOT_P(function_name));
        if (UNEXPECTED(fbc == NULL)) {
-               func = zend_hash_find(EG(function_table), Z_STR_P(function_name+1));
+               func = zend_hash_find_ex(EG(function_table), Z_STR_P(function_name+1), 1);
                if (UNEXPECTED(func == NULL)) {
                        SAVE_OPLINE();
                        zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(function_name));
@@ -2230,10 +2232,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CON
        func_name = RT_CONSTANT(opline, opline->op2) + 1;
        fbc = CACHED_PTR(Z_CACHE_SLOT_P(RT_CONSTANT(opline, opline->op2)));
        if (UNEXPECTED(fbc == NULL)) {
-               func = zend_hash_find(EG(function_table), Z_STR_P(func_name));
+               func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
                if (func == NULL) {
                        func_name++;
-                       func = zend_hash_find(EG(function_table), Z_STR_P(func_name));
+                       func = zend_hash_find_ex(EG(function_table), Z_STR_P(func_name), 1);
                        if (UNEXPECTED(func == NULL)) {
                                SAVE_OPLINE();
                                zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
@@ -2266,7 +2268,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_SPEC_CO
 
        fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
        if (UNEXPECTED(fbc == NULL)) {
-               func = zend_hash_find(EG(function_table), Z_STR_P(fname));
+               func = zend_hash_find_ex(EG(function_table), Z_STR_P(fname), 1);
                if (UNEXPECTED(func == NULL)) {
                    SAVE_OPLINE();
                        zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(fname));
@@ -2362,8 +2364,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYE
        zval *zce, *orig_zce;
 
        SAVE_OPLINE();
-       if ((zce = zend_hash_find(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)))) == NULL ||
-           ((orig_zce = zend_hash_find(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)+1))) != NULL &&
+       if ((zce = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1)) == NULL ||
+           ((orig_zce = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)+1), 1)) != NULL &&
             Z_CE_P(zce) != Z_CE_P(orig_zce))) {
                do_bind_inherited_class(&EX(func)->op_array, opline, EG(class_table), Z_CE_P(EX_VAR(opline->op2.var)), 0);
        }
@@ -2372,13 +2374,15 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYE
 
 static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_INHERITED_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
 {
+       zval *zv;
        zend_class_entry *ce;
        USE_OPLINE
 
        SAVE_OPLINE();
-       ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)));
+       zv = zend_hash_find_ex(EG(class_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
+       ZEND_ASSERT(zv != NULL);
+       ce = Z_CE_P(zv);
        Z_CE_P(EX_VAR(opline->result.var)) = ce;
-       ZEND_ASSERT(ce != NULL);
 
        if (ce->ce_flags & ZEND_ACC_ANON_BOUND) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
@@ -5062,7 +5066,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_H
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -5162,7 +5166,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -5780,7 +5784,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONS
 {
        zend_class_entry *ce, *scope;
        zend_class_constant *c;
-       zval *value;
+       zval *value, *zv;
        USE_OPLINE
 
        SAVE_OPLINE();
@@ -5818,7 +5822,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONS
                        }
                }
 
-               if (EXPECTED((c = zend_hash_find_ptr(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)))) != NULL)) {
+               zv = zend_hash_find_ex(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)), 1);
+               if (EXPECTED(zv != NULL)) {
+                       c = Z_PTR_P(zv);
                        scope = EX(func)->op_array.scope;
                        if (!zend_verify_const_access(c, scope)) {
                                zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
@@ -6140,7 +6146,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, IS_CONST == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -6497,14 +6503,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_CONST_CONST
        jumptable = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
 
        if (Z_TYPE_P(op) != IS_STRING) {
-               ZVAL_DEREF(op);
-               if (Z_TYPE_P(op) != IS_STRING) {
+               if (IS_CONST == IS_CONST) {
                        /* Wrong type, fall back to ZEND_CASE chain */
                        ZEND_VM_NEXT_OPCODE();
+               } else {
+                       ZVAL_DEREF(op);
+                       if (Z_TYPE_P(op) != IS_STRING) {
+                               /* Wrong type, fall back to ZEND_CASE chain */
+                               ZEND_VM_NEXT_OPCODE();
+                       }
                }
        }
 
-       jump_zv = zend_hash_find(jumptable, Z_STR_P(op));
+       jump_zv = zend_hash_find_ex(jumptable, Z_STR_P(op), IS_CONST == IS_CONST);
        if (jump_zv != NULL) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, Z_LVAL_P(jump_zv));
                ZEND_VM_CONTINUE();
@@ -7188,7 +7199,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       retval = zend_hash_find(target_symbol_table, name);
+       retval = zend_hash_find_ex(target_symbol_table, name, IS_CONST == IS_CONST);
        if (retval == NULL) {
                if (UNEXPECTED(zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS)))) {
                        zval *result;
@@ -7861,7 +7872,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_U
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       value = zend_hash_find_ind(target_symbol_table, name);
+       value = zend_hash_find_ex_ind(target_symbol_table, name, IS_CONST == IS_CONST);
 
        if (IS_CONST != IS_CONST) {
                zend_tmp_string_release(tmp_name);
@@ -7975,7 +7986,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_C
        zval *object;
        zend_class_entry *called_scope;
 
-       zfunc = zend_hash_find(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)));
+       zfunc = zend_hash_find_ex(EG(function_table), Z_STR_P(RT_CONSTANT(opline, opline->op1)), 1);
        ZEND_ASSERT(zfunc != NULL && Z_FUNC_P(zfunc)->type == ZEND_USER_FUNCTION);
 
        if (Z_TYPE(EX(This)) == IS_OBJECT) {
@@ -9167,7 +9178,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CV_HAND
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -9267,7 +9278,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CV_HAN
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -10077,7 +10088,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, IS_CV == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -11240,7 +11251,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_TMPVAR_
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -11341,7 +11352,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_TMPVAR
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -12099,7 +12110,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, (IS_TMP_VAR|IS_VAR) == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -13786,7 +13797,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CONST_HAN
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -15161,7 +15172,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_CV_HANDLE
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -15714,7 +15725,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_TMP_TMPVAR_HA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -18557,7 +18568,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CONST_HAN
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -18779,7 +18790,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -18933,7 +18944,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -19087,7 +19098,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -19241,7 +19252,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -19894,7 +19905,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_
 {
        zend_class_entry *ce, *scope;
        zend_class_constant *c;
-       zval *value;
+       zval *value, *zv;
        USE_OPLINE
 
        SAVE_OPLINE();
@@ -19932,7 +19943,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_VAR_
                        }
                }
 
-               if (EXPECTED((c = zend_hash_find_ptr(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)))) != NULL)) {
+               zv = zend_hash_find_ex(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)), 1);
+               if (EXPECTED(zv != NULL)) {
+                       c = Z_PTR_P(zv);
                        scope = EX(func)->op_array.scope;
                        if (!zend_verify_const_access(c, scope)) {
                                zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
@@ -22870,7 +22883,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_CV_HANDLE
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -23092,7 +23105,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -23246,7 +23259,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -23400,7 +23413,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -23554,7 +23567,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -25480,7 +25493,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_VAR_TMPVAR_HA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -25703,7 +25716,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -25857,7 +25870,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -26011,7 +26024,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -26165,7 +26178,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -27543,7 +27556,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CONST_
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -27690,7 +27703,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CONST
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -27860,7 +27873,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -28014,7 +28027,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -28168,7 +28181,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -28322,7 +28335,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -28753,7 +28766,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_UNUS
 {
        zend_class_entry *ce, *scope;
        zend_class_constant *c;
-       zval *value;
+       zval *value, *zv;
        USE_OPLINE
 
        SAVE_OPLINE();
@@ -28791,7 +28804,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_UNUS
                        }
                }
 
-               if (EXPECTED((c = zend_hash_find_ptr(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)))) != NULL)) {
+               zv = zend_hash_find_ex(&ce->constants_table, Z_STR_P(RT_CONSTANT(opline, opline->op2)), 1);
+               if (EXPECTED(zv != NULL)) {
+                       c = Z_PTR_P(zv);
                        scope = EX(func)->op_array.scope;
                        if (!zend_verify_const_access(c, scope)) {
                                zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(ce->name), Z_STRVAL_P(RT_CONSTANT(opline, opline->op2)));
@@ -30177,7 +30192,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_CV_HAN
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -30324,7 +30339,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_CV_HA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -30494,7 +30509,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -30648,7 +30663,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -30802,7 +30817,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -30956,7 +30971,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -31932,7 +31947,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_UNUSED_TMPVAR
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -32080,7 +32095,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_UNUSED_TMPVA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -32251,7 +32266,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -32405,7 +32420,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -32559,7 +32574,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -32713,7 +32728,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -36507,7 +36522,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CONST_HAND
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -36654,7 +36669,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CONST_HAN
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -36837,7 +36852,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -36991,7 +37006,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -37145,7 +37160,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -37299,7 +37314,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -38518,7 +38533,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, IS_CONST == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -38883,7 +38898,7 @@ static ZEND_VM_HOT ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_GLOBAL_SPEC_C
                }
        }
 
-       value = zend_hash_find(&EG(symbol_table), Z_STR_P(varname));
+       value = zend_hash_find_ex(&EG(symbol_table), Z_STR_P(varname), 1);
        if (UNEXPECTED(value == NULL)) {
                value = zend_hash_add_new(&EG(symbol_table), Z_STR_P(varname), &EG(uninitialized_zval));
                idx = (char*)value - (char*)EG(symbol_table).arData;
@@ -38962,7 +38977,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_STATIC_SPEC_CV_CONST_HAND
        }
 
        varname = RT_CONSTANT(opline, opline->op2);
-       value = zend_hash_find(ht, Z_STR_P(varname));
+       value = zend_hash_find_ex(ht, Z_STR_P(varname), 1);
 
        if (opline->extended_value) {
                if (Z_TYPE_P(value) == IS_CONSTANT_AST) {
@@ -39031,14 +39046,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_CV_CONST_HA
        jumptable = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
 
        if (Z_TYPE_P(op) != IS_STRING) {
-               ZVAL_DEREF(op);
-               if (Z_TYPE_P(op) != IS_STRING) {
+               if (IS_CV == IS_CONST) {
                        /* Wrong type, fall back to ZEND_CASE chain */
                        ZEND_VM_NEXT_OPCODE();
+               } else {
+                       ZVAL_DEREF(op);
+                       if (Z_TYPE_P(op) != IS_STRING) {
+                               /* Wrong type, fall back to ZEND_CASE chain */
+                               ZEND_VM_NEXT_OPCODE();
+                       }
                }
        }
 
-       jump_zv = zend_hash_find(jumptable, Z_STR_P(op));
+       jump_zv = zend_hash_find_ex(jumptable, Z_STR_P(op), IS_CV == IS_CONST);
        if (jump_zv != NULL) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, Z_LVAL_P(jump_zv));
                ZEND_VM_CONTINUE();
@@ -40108,7 +40128,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       retval = zend_hash_find(target_symbol_table, name);
+       retval = zend_hash_find_ex(target_symbol_table, name, IS_CV == IS_CONST);
        if (retval == NULL) {
                if (UNEXPECTED(zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS)))) {
                        zval *result;
@@ -41075,7 +41095,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_CV_UNUS
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       value = zend_hash_find_ind(target_symbol_table, name);
+       value = zend_hash_find_ex_ind(target_symbol_table, name, IS_CV == IS_CONST);
 
        if (IS_CV != IS_CONST) {
                zend_tmp_string_release(tmp_name);
@@ -42992,7 +43012,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_CV_HANDLER
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -43139,7 +43159,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_CV_HANDLE
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -43322,7 +43342,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -43476,7 +43496,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -43630,7 +43650,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -43784,7 +43804,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -44910,7 +44930,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, IS_CV == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -46699,7 +46719,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CV_TMPVAR_HAN
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -46847,7 +46867,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CV_TMPVAR_HA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -47031,7 +47051,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -47185,7 +47205,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -47339,7 +47359,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -47493,7 +47513,7 @@ fast_assign_obj:
                                        }
                                        zobj->properties = zend_array_dup(zobj->properties);
                                }
-                               property_val = zend_hash_find(zobj->properties, Z_STR_P(property));
+                               property_val = zend_hash_find_ex(zobj->properties, Z_STR_P(property), 1);
                                if (property_val) {
                                        goto fast_assign_obj;
                                }
@@ -48510,7 +48530,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, (IS_TMP_VAR|IS_VAR) == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -50094,7 +50114,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CONST
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -50621,7 +50641,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, IS_CONST == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -50859,14 +50879,19 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SWITCH_STRING_SPEC_TMPVAR_CONS
        jumptable = Z_ARRVAL_P(RT_CONSTANT(opline, opline->op2));
 
        if (Z_TYPE_P(op) != IS_STRING) {
-               ZVAL_DEREF(op);
-               if (Z_TYPE_P(op) != IS_STRING) {
+               if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
                        /* Wrong type, fall back to ZEND_CASE chain */
                        ZEND_VM_NEXT_OPCODE();
+               } else {
+                       ZVAL_DEREF(op);
+                       if (Z_TYPE_P(op) != IS_STRING) {
+                               /* Wrong type, fall back to ZEND_CASE chain */
+                               ZEND_VM_NEXT_OPCODE();
+                       }
                }
        }
 
-       jump_zv = zend_hash_find(jumptable, Z_STR_P(op));
+       jump_zv = zend_hash_find_ex(jumptable, Z_STR_P(op), (IS_TMP_VAR|IS_VAR) == IS_CONST);
        if (jump_zv != NULL) {
                ZEND_VM_SET_RELATIVE_OPCODE(opline, Z_LVAL_P(jump_zv));
                ZEND_VM_CONTINUE();
@@ -51218,7 +51243,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       retval = zend_hash_find(target_symbol_table, name);
+       retval = zend_hash_find_ex(target_symbol_table, name, (IS_TMP_VAR|IS_VAR) == IS_CONST);
        if (retval == NULL) {
                if (UNEXPECTED(zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS)))) {
                        zval *result;
@@ -51537,7 +51562,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_VAR_SPEC_TMPVAR_
        }
 
        target_symbol_table = zend_get_target_symbol_table(opline->extended_value & ZEND_FETCH_TYPE_MASK EXECUTE_DATA_CC);
-       value = zend_hash_find_ind(target_symbol_table, name);
+       value = zend_hash_find_ex_ind(target_symbol_table, name, (IS_TMP_VAR|IS_VAR) == IS_CONST);
 
        if ((IS_TMP_VAR|IS_VAR) != IS_CONST) {
                zend_tmp_string_release(tmp_name);
@@ -52480,7 +52505,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_CV_HA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -52857,7 +52882,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, IS_CV == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop:
@@ -53839,7 +53864,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_TMPVAR_TMPVA
                                                }
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_DYNAMIC_PROPERTY_OFFSET);
                                        }
-                                       retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
+                                       retval = zend_hash_find_ex(zobj->properties, Z_STR_P(offset), 1);
                                        if (EXPECTED(retval)) {
                                                uintptr_t idx = (char*)retval - (char*)zobj->properties->arData;
                                                CACHE_PTR_EX(cache_slot + 1, (void*)ZEND_ENCODE_DYN_PROP_OFFSET(idx));
@@ -54218,7 +54243,7 @@ isset_again:
                                }
                        }
 str_index_prop:
-                       value = zend_hash_find_ind(ht, str);
+                       value = zend_hash_find_ex_ind(ht, str, (IS_TMP_VAR|IS_VAR) == IS_CONST);
                } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
                        hval = Z_LVAL_P(offset);
 num_index_prop: