summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_execute.h
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-12-09 09:15:27 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-12-09 09:15:27 +0100
commit32c1f37574a12452d967c5d8d8c81e9b66db726c (patch)
treed651412329afb857f853d9fc53085cc7b3b397c9 /Zend/zend_vm_execute.h
parent3d90b770e8d490989294101745d161b8347ae9d4 (diff)
downloadphp-git-32c1f37574a12452d967c5d8d8c81e9b66db726c.tar.gz
Fixed bug #78926: Handle class table reallocation on failed link
When we change back the bucket key on a class linking failure, make sure to reload the bucket pointer, as the class table may have been reallocated in the meantime. Also remove a bogus bucket key change in anon class registration: We don't actually rename the class in this case anymore, the RTD key is already the final name.
Diffstat (limited to 'Zend/zend_vm_execute.h')
-rw-r--r--Zend/zend_vm_execute.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index a0cfc277bd..3d10728415 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -2451,7 +2451,6 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_CLASS_SPEC_HANDLE
if (!(ce->ce_flags & ZEND_ACC_LINKED)) {
SAVE_OPLINE();
if (zend_do_link_class(ce, (opline->op2_type == IS_CONST) ? Z_STR_P(RT_CONSTANT(opline, opline->op2)) : NULL) == FAILURE) {
- zend_hash_set_bucket_key(EG(class_table), (Bucket *) zv, rtd_key);
HANDLE_EXCEPTION();
}
}
@@ -6395,6 +6394,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_DELAYED_SPEC_CON
zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name));
} else {
if (zend_do_link_class(ce, Z_STR_P(RT_CONSTANT(opline, opline->op2))) == FAILURE) {
+ /* Reload bucket pointer, the hash table may have been reallocated */
+ zv = zend_hash_find(EG(class_table), Z_STR_P(lcname));
zend_hash_set_bucket_key(EG(class_table), (Bucket *) zv, Z_STR_P(lcname + 1));
HANDLE_EXCEPTION();
}