php-src/Zend/tests/exception_017.phpt
Nikita Popov c9f27ee422 Display EngineExceptions like ordinary exceptions
TypeException stays as-is for now because it uses messages that are
incompatible with the way exception messages are displayed.

closure_038.phpt and a few others now show that we're generating
too many exceptions for compound operations on undefined properties
-- this needs to be fixed in a followup.
2015-05-15 23:40:32 +02:00

40 lines
955 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 (EngineException $e) {
echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n";
}
try {
foo("C::foo");
} catch (EngineException $e) {
echo "\n";
do {
echo "Exception: " . $e->getMessage() . "\n";
$e = $e->getPrevious();
} while ($e instanceof EngineException);
}
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()
Fatal error: Uncaught exception 'EngineException' with message 'Cannot call abstract method C::foo()' in %sexception_017.php:%d
Stack trace:
#0 {main}
thrown in %sexception_017.php on line %d