From b359ecdc703e65aeaf20115e0b6f16eab217d94b Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Wed, 22 Oct 2025 23:52:24 +0100 Subject: [PATCH 1/2] Zend: add test for zend_call_function() with deprecation exception --- .../zend_call_function_deprecated_frame.phpt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Zend/tests/functions/zend_call_function_deprecated_frame.phpt diff --git a/Zend/tests/functions/zend_call_function_deprecated_frame.phpt b/Zend/tests/functions/zend_call_function_deprecated_frame.phpt new file mode 100644 index 0000000000000..ce2943a876e2b --- /dev/null +++ b/Zend/tests/functions/zend_call_function_deprecated_frame.phpt @@ -0,0 +1,25 @@ +--TEST-- +Deprecated function notice promoted to exception within zend_call_function() +--FILE-- + +--EXPECTF-- +Fatal error: Uncaught Exception: Function foo() is deprecated in %s:%d +Stack trace: +#0 [internal function]: {closure:%s:%d}(16384, 'Function foo() ...', '%s', %d) +#1 %s(%d): array_map(Object(Closure), Array) +#2 {main} + thrown in %s on line %d From 6b80ccb52a5ca90d7b30426876c761f0ff6098d9 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Wed, 22 Oct 2025 23:37:04 +0100 Subject: [PATCH 2/2] Zend: emit function deprecation before setting up call frame --- Zend/zend_execute_API.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 54ddcd48f2d3f..f174aac49ef4d 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -862,18 +862,17 @@ zend_result zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_ call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_HAS_THIS; } - call = zend_vm_stack_push_call_frame(call_info, - func, fci->param_count, object_or_called_scope); - if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_DEPRECATED)) { zend_deprecated_function(func); if (UNEXPECTED(EG(exception))) { - zend_vm_stack_free_call_frame(call); return SUCCESS; } } + call = zend_vm_stack_push_call_frame(call_info, + func, fci->param_count, object_or_called_scope); + for (uint32_t i = 0; i < fci->param_count; i++) { zval *param = ZEND_CALL_ARG(call, i+1); zval *arg = &fci->params[i];