Skip to content

Commit 270af52

Browse files
committed
Zend: Use zend_bad_method_call() when cloning from the wrong scope
1 parent 5de43f4 commit 270af52

File tree

4 files changed

+6
-19
lines changed

4 files changed

+6
-19
lines changed

‎Zend/zend_builtin_functions.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,7 @@ ZEND_FUNCTION(clone)
9090
}
9191

9292
if (clone && !zend_check_method_accessible(clone, scope)) {
93-
zend_throw_error(NULL, "Call to %s %s::__clone() from %s%s",
94-
zend_visibility_string(clone->common.fn_flags), ZSTR_VAL(clone->common.scope->name),
95-
scope ? "scope " : "global scope",
96-
scope ? ZSTR_VAL(scope->name) : ""
97-
);
93+
zend_bad_method_call(clone, clone->common.function_name, scope);
9894
RETURN_THROWS();
9995
}
10096

‎Zend/zend_execute.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,15 +4123,6 @@ static zend_never_inline void zend_fetch_this_var(int type OPLINE_DC EXECUTE_DAT
41234123
}
41244124
}
41254125

4126-
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_clone_call(zend_function *clone, zend_class_entry *scope)
4127-
{
4128-
zend_throw_error(NULL, "Call to %s %s::__clone() from %s%s",
4129-
zend_visibility_string(clone->common.fn_flags), ZSTR_VAL(clone->common.scope->name),
4130-
scope ? "scope " : "global scope",
4131-
scope ? ZSTR_VAL(scope->name) : ""
4132-
);
4133-
}
4134-
41354126
#if ZEND_INTENSIVE_DEBUGGING
41364127

41374128
#define CHECK_SYMBOL_TABLES() \

‎Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6044,7 +6044,7 @@ ZEND_VM_COLD_CONST_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|THIS|CV, ANY)
60446044
if (clone && !(clone->common.fn_flags & ZEND_ACC_PUBLIC)) {
60456045
scope = EX(func)->op_array.scope;
60466046
if (!zend_check_method_accessible(clone, scope)) {
6047-
zend_wrong_clone_call(clone, scope);
6047+
zend_bad_method_call(clone, clone->common.function_name, scope);
60486048
FREE_OP1();
60496049
ZVAL_UNDEF(EX_VAR(opline->result.var));
60506050
HANDLE_EXCEPTION();

‎Zend/zend_vm_execute.h

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)