Skip to content

Commit c4a0fc6

Browse files
authored
Fix zend_fcc_equals() with trampolines (#10012)
We cannot compare the function handler pointer directly for trampolines, as they may be reallocated
1 parent 9f0e4a5 commit c4a0fc6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Zend/zend_API.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,14 @@ ZEND_API zend_result zend_fcall_info_call(zend_fcall_info *fci, zend_fcall_info_
733733
/* Zend FCC API to store and handle PHP userland functions */
734734
static zend_always_inline bool zend_fcc_equals(const zend_fcall_info_cache* a, const zend_fcall_info_cache* b)
735735
{
736+
if (UNEXPECTED((a->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) &&
737+
(b->function_handler->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE))) {
738+
return a->object == b->object
739+
&& a->calling_scope == b->calling_scope
740+
&& a->closure == b->closure
741+
&& zend_string_equals(a->function_handler->common.function_name, b->function_handler->common.function_name)
742+
;
743+
}
736744
return a->function_handler == b->function_handler
737745
&& a->object == b->object
738746
&& a->calling_scope == b->calling_scope

0 commit comments

Comments
 (0)