1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 12:42:29 +02:00
Files
archived-php-src/Zend/tests/exception_017.phpt
2019-01-30 09:19:02 +01:00

41 lines
668 B
PHP

--TEST--
Exceptions on improper usage of $this
--FILE--
<?php
abstract class C {
abstract static function foo();
}
function foo(callable $x) {
}
try {
C::foo();
} catch (Error $e) {
echo $e, "\n\n";
}
try {
foo("C::foo");
} catch (Error $e) {
echo $e, "\n\n";
}
C::foo();
?>
--EXPECTF--
Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}
TypeError: Argument 1 passed to foo() must be callable, string given, called in %s on line %d and defined in %s:%d
Stack trace:
#0 %s(%d): foo('C::foo')
#1 {main}
Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d