2015-04-01 21:48:15 +08:00
|
|
|
--TEST--
|
|
|
|
Exceptions on improper usage of $this
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
abstract class C {
|
|
|
|
abstract static function foo();
|
|
|
|
}
|
|
|
|
|
|
|
|
function foo(callable $x) {
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
C::foo();
|
2015-05-18 06:31:43 +08:00
|
|
|
} catch (Error $e) {
|
2015-04-01 21:48:15 +08:00
|
|
|
echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
foo("C::foo");
|
2015-05-18 06:31:43 +08:00
|
|
|
} catch (Error $e) {
|
2015-04-01 21:48:15 +08:00
|
|
|
echo "\n";
|
|
|
|
do {
|
|
|
|
echo "Exception: " . $e->getMessage() . "\n";
|
|
|
|
$e = $e->getPrevious();
|
2015-05-18 06:31:43 +08:00
|
|
|
} while ($e instanceof Error);
|
2015-04-01 21:48:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
C::foo();
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
Exception: Cannot call abstract method C::foo() in %sexception_017.php on line %d
|
|
|
|
|
|
|
|
Exception: Argument 1 passed to foo() must be callable, string given, called in %sexception_017.php on line %d
|
|
|
|
Exception: Cannot call abstract method C::foo()
|
|
|
|
|
2015-05-18 06:31:43 +08:00
|
|
|
Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %sexception_017.php:%d
|
2015-05-16 03:04:07 +08:00
|
|
|
Stack trace:
|
|
|
|
#0 {main}
|
|
|
|
thrown in %sexception_017.php on line %d
|