php-src/Zend/tests/bug52361.phpt
Nikita Popov 3ae995f03c Tweak uncaught exception message display
This implements a reduced variant of #1226 with just the following
change:

-Fatal error: Uncaught exception 'EngineException' with message 'Call to private method foo::bar() from context ''' in %s:%d
+Fatal error: Uncaught EngineException: Call to private method foo::bar() from context '' in %s:%d

The '' wrapper around messages is very weird if the exception
message itself contains ''. Futhermore having the message wrapped
in '' doesn't work for the "and defined" suffix of
TypeExceptions.
2015-05-17 18:47:06 +02:00

36 lines
640 B
PHP

--TEST--
Bug #52361 (Throwing an exception in a destructor causes invalid catching)
--FILE--
<?php
class aaa {
public function __destruct() {
try {
throw new Exception(__CLASS__);
} catch(Exception $ex) {
echo "1. $ex\n";
}
}
}
function bbb() {
$a = new aaa();
throw new Exception(__FUNCTION__);
}
try {
bbb();
echo "must be skipped !!!";
} catch(Exception $ex) {
echo "2. $ex\n";
}
?>
--EXPECTF--
1. Exception: aaa in %sbug52361.php:5
Stack trace:
#0 %sbug52361.php(13): aaa->__destruct()
#1 %sbug52361.php(16): bbb()
#2 {main}
2. Exception: bbb in %sbug52361.php:13
Stack trace:
#0 %sbug52361.php(16): bbb()
#1 {main}