Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions Zend/tests/bug48770_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ class B extends A {
public function func($str) {
call_user_func_array(array($this, 'parent::func2'), array($str));
call_user_func_array(array($this, 'parent::func3'), array($str));
call_user_func_array(array($this, 'parent::func22'), array($str));
call_user_func_array(array($this, 'parent::inexistent'), array($str));

try {
call_user_func_array(array($this, 'parent::func22'), array($str));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}

try {
call_user_func_array(array($this, 'parent::inexistent'), array($str));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
private function func2($str) {
var_dump(__METHOD__ .': '. $str);
Expand All @@ -45,10 +55,8 @@ $c = new C;
$c->func('This should work!');

?>
--EXPECTF--
--EXPECT--
string(27) "A::func2: This should work!"
string(27) "A::func3: This should work!"

Warning: call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22() in %s on line %d

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent' in %s on line %d
call_user_func_array() expects parameter 1 to be a valid callback, cannot access private method A::func22()
call_user_func_array() expects parameter 1 to be a valid callback, class 'A' does not have a method 'inexistent'
12 changes: 8 additions & 4 deletions Zend/tests/bug48770_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ class B extends A {
public function func($str) {
call_user_func_array(array($this, 'self::func2'), array($str));
call_user_func_array(array($this, 'self::func3'), array($str));
call_user_func_array(array($this, 'self::inexistent'), array($str));

try {
call_user_func_array(array($this, 'self::inexistent'), array($str));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
}
private function func2($str) {
var_dump(__METHOD__ .': '. $str);
Expand All @@ -44,8 +49,7 @@ $c = new C;
$c->func('This should work!');

?>
--EXPECTF--
--EXPECT--
string(27) "B::func2: This should work!"
string(27) "B::func3: This should work!"

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent' in %s on line %d
call_user_func_array() expects parameter 1 to be a valid callback, class 'B' does not have a method 'inexistent'