Skip to content

Commit

Permalink
Fix parameter name in call_user_func() error message
Browse files Browse the repository at this point in the history
This parameter name has been changed to $callback.
  • Loading branch information
nikic committed Jul 29, 2021
1 parent 3244e07 commit 840e441
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Zend/tests/bug45186.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ string(1) "y"
ok
__callstatic:
string(3) "www"
call_user_func(): Argument #1 ($function) must be a valid callback, cannot access "self" when no class scope is active
call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active
4 changes: 2 additions & 2 deletions Zend/tests/bug45186_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ string(1) "y"
__call:
string(1) "y"
ok
call_user_func(): Argument #1 ($function) must be a valid callback, class bar does not have a method "www"
call_user_func(): Argument #1 ($function) must be a valid callback, cannot access "self" when no class scope is active
call_user_func(): Argument #1 ($callback) must be a valid callback, class bar does not have a method "www"
call_user_func(): Argument #1 ($callback) must be a valid callback, cannot access "self" when no class scope is active
4 changes: 2 additions & 2 deletions Zend/tests/bug48770_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ $c->func('This should work!');
--EXPECT--
string(27) "B::func2: This should work!"
string(27) "B::func3: This should work!"
call_user_func_array(): Argument #1 ($function) must be a valid callback, cannot access private method B::func22()
call_user_func_array(): Argument #1 ($function) must be a valid callback, class B does not have a method "inexistent"
call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method B::func22()
call_user_func_array(): Argument #1 ($callback) must be a valid callback, class B does not have a method "inexistent"
2 changes: 1 addition & 1 deletion Zend/tests/bug48770_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ $c->func('This should work!');
--EXPECT--
string(27) "B::func2: This should work!"
string(27) "B::func3: This should work!"
call_user_func_array(): Argument #1 ($function) must be a valid callback, class C does not have a method "inexistent"
call_user_func_array(): Argument #1 ($callback) must be a valid callback, class C does not have a method "inexistent"
8 changes: 4 additions & 4 deletions Zend/tests/call_user_func_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ try {
?>
--EXPECTF--
string(3) "foo"
call_user_func(): Argument #1 ($function) must be a valid callback, class "foo" not found
call_user_func(): Argument #1 ($function) must be a valid callback, class "" not found
call_user_func(): Argument #1 ($callback) must be a valid callback, class "foo" not found
call_user_func(): Argument #1 ($callback) must be a valid callback, class "" not found

Warning: Undefined variable $foo in %s on line %d
call_user_func(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object
call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object

Warning: Undefined variable $foo in %s on line %d
call_user_func(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object
call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
2 changes: 1 addition & 1 deletion Zend/tests/methods-on-non-objects-call-user-func.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ try {
}
?>
--EXPECT--
call_user_func(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object
call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
2 changes: 1 addition & 1 deletion Zend/tests/nullsafe_operator/013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool(false)
bool(false)
string(1) "%s"
int(0)
string(98) "call_user_func_array(): Argument #1 ($function) must be a valid callback, no array or string given"
string(98) "call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given"
string(77) "call_user_func_array(): Argument #2 ($args) must be of type array, null given"
string(69) "get_class(): Argument #1 ($object) must be of type object, null given"
string(55) "get_called_class() expects exactly 0 arguments, 1 given"
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_vm_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -3787,7 +3787,7 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
init_func_run_time_cache(&func->op_array);
}
} else {
zend_type_error("%s(): Argument #1 ($function) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
FREE_OP2();
HANDLE_EXCEPTION();
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_vm_execute.h
Original file line number Diff line number Diff line change
Expand Up @@ -6720,7 +6720,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS
init_func_run_time_cache(&func->op_array);
}
} else {
zend_type_error("%s(): Argument #1 ($function) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);

HANDLE_EXCEPTION();
Expand Down Expand Up @@ -9011,7 +9011,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV
init_func_run_time_cache(&func->op_array);
}
} else {
zend_type_error("%s(): Argument #1 ($function) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);
zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
HANDLE_EXCEPTION();
Expand Down Expand Up @@ -11393,7 +11393,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H
init_func_run_time_cache(&func->op_array);
}
} else {
zend_type_error("%s(): Argument #1 ($function) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
zend_type_error("%s(): Argument #1 ($callback) must be a valid callback, %s", Z_STRVAL_P(RT_CONSTANT(opline, opline->op1)), error);
efree(error);

HANDLE_EXCEPTION();
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/general_functions/callbacks_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ O
$this|O::who
O
$this|B::who
call_user_func(): Argument #1 ($function) must be a valid callback, class P is not a subclass of B
call_user_func(): Argument #1 ($callback) must be a valid callback, class P is not a subclass of B
6 changes: 3 additions & 3 deletions ext/standard/tests/general_functions/callbacks_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ try {

?>
--EXPECT--
call_user_func(): Argument #1 ($function) must be a valid callback, class "Foo" not found
call_user_func(): Argument #1 ($function) must be a valid callback, first array member is not a valid class name or object
call_user_func(): Argument #1 ($function) must be a valid callback, second array member is not a valid method
call_user_func(): Argument #1 ($callback) must be a valid callback, class "Foo" not found
call_user_func(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
call_user_func(): Argument #1 ($callback) must be a valid callback, second array member is not a valid method
2 changes: 1 addition & 1 deletion tests/classes/abstract_user_call.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ try {
?>
--EXPECT--
test::func()
call_user_func(): Argument #1 ($function) must be a valid callback, cannot call abstract method test_base::func()
call_user_func(): Argument #1 ($callback) must be a valid callback, cannot call abstract method test_base::func()
2 changes: 1 addition & 1 deletion tests/classes/autoload_012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ try {
?>
--EXPECT--
In autoload: string(6) "UndefC"
call_user_func(): Argument #1 ($function) must be a valid callback, class "UndefC" not found
call_user_func(): Argument #1 ($callback) must be a valid callback, class "UndefC" not found
2 changes: 1 addition & 1 deletion tests/classes/bug27504.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ try {
?>
--EXPECT--
Called function foo:bar(1)
call_user_func_array(): Argument #1 ($function) must be a valid callback, cannot access private method foo::bar()
call_user_func_array(): Argument #1 ($callback) must be a valid callback, cannot access private method foo::bar()
Call to private method foo::bar() from global scope

0 comments on commit 840e441

Please sign in to comment.