Skip to content

Commit 140fd43

Browse files
committed
fixup! Improve error message for deprecated methods
1 parent 9d400d1 commit 140fd43

File tree

4 files changed

+5
-17
lines changed

4 files changed

+5
-17
lines changed

Zend/zend_execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,7 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_property_read(z
15091509
zend_tmp_string_release(tmp_property_name);
15101510
}
15111511

1512-
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc)
1512+
ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc)
15131513
{
15141514
if (fbc->common.scope) {
15151515
zend_error(E_DEPRECATED, "Method %s::%s() is deprecated",

Zend/zend_execute.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
4444
ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
4545
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
4646
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
47+
extern ZEND_API zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function(const zend_function *fbc);
4748
ZEND_API int zend_eval_string(const char *str, zval *retval_ptr, const char *string_name);
4849
ZEND_API int zend_eval_stringl(const char *str, size_t str_len, zval *retval_ptr, const char *string_name);
4950
ZEND_API int zend_eval_string_ex(const char *str, zval *retval_ptr, const char *string_name, int handle_exceptions);

Zend/zend_execute_API.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -722,14 +722,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
722722
func, fci->param_count, object_or_called_scope);
723723

724724
if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_DEPRECATED)) {
725-
if (func->common.scope) {
726-
zend_error(E_DEPRECATED, "Method %s::%s() is deprecated",
727-
ZSTR_VAL(func->common.scope->name),
728-
ZSTR_VAL(func->common.function_name)
729-
);
730-
} else {
731-
zend_error(E_DEPRECATED, "Function %s() is deprecated", ZSTR_VAL(func->common.function_name));
732-
}
725+
zend_deprecated_function(func);
733726

734727
if (UNEXPECTED(EG(exception))) {
735728
zend_vm_stack_free_call_frame(call);

ext/opcache/jit/zend_jit_vm_helpers.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,8 @@ void ZEND_FASTCALL zend_jit_deprecated_helper(OPLINE_D)
157157
{
158158
zend_execute_data *call = (zend_execute_data *) opline;
159159
zend_function *fbc = call->func;
160-
if (fbc->common.scope) {
161-
zend_error(E_DEPRECATED, "Method %s::%s() is deprecated",
162-
ZSTR_VAL(fbc->common.scope->name),
163-
ZSTR_VAL(fbc->common.function_name)
164-
);
165-
} else {
166-
zend_error(E_DEPRECATED, "Function %s() is deprecated", ZSTR_VAL(fbc->common.function_name));
167-
}
160+
161+
zend_deprecated_function(fbc);
168162

169163
if (EG(exception)) {
170164
#ifndef HAVE_GCC_GLOBAL_REGS

0 commit comments

Comments
 (0)