Skip to content

Commit 9ce51da

Browse files
committed
Add missing hooks JIT restart code
Closes GH-19207.
1 parent b82c8ba commit 9ce51da

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ PHP NEWS
4646
- Opcache:
4747
. Reset global pointers to prevent use-after-free in zend_jit_status().
4848
(Florian Engelhardt)
49+
. Fix issue with JIT restart and hooks. (nielsdos)
4950

5051
- OpenSSL:
5152
. Fixed bug GH-18986 (OpenSSL backend: incorrect RAND_{load,write}_file()

ext/opcache/jit/zend_jit.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,6 +3836,24 @@ static void zend_jit_restart_preloaded_script(zend_persistent_script *script)
38363836
zend_jit_restart_preloaded_op_array(op_array);
38373837
}
38383838
} ZEND_HASH_FOREACH_END();
3839+
3840+
if (ce->num_hooked_props > 0) {
3841+
zend_property_info *prop;
3842+
3843+
ZEND_HASH_MAP_FOREACH_PTR(&ce->properties_info, prop) {
3844+
if (prop->hooks) {
3845+
for (uint32_t i = 0; i < ZEND_PROPERTY_HOOK_COUNT; i++) {
3846+
if (prop->hooks[i]) {
3847+
op_array = &prop->hooks[i]->op_array;
3848+
ZEND_ASSERT(op_array->type == ZEND_USER_FUNCTION);
3849+
if (!(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
3850+
zend_jit_restart_preloaded_op_array(op_array);
3851+
}
3852+
}
3853+
}
3854+
}
3855+
} ZEND_HASH_FOREACH_END();
3856+
}
38393857
} ZEND_HASH_FOREACH_END();
38403858
}
38413859

0 commit comments

Comments
 (0)