mirror of
https://github.com/php/php-src.git
synced 2024-12-17 22:09:12 +08:00
23ee4d4b57
RFC: https://wiki.php.net/rfc/non-capturing_catches Closes GH-5345.
27 lines
571 B
PHP
27 lines
571 B
PHP
--TEST--
|
|
catch without capturing a variable - exception in destructor
|
|
--FILE--
|
|
<?php
|
|
class ThrowsOnDestruct extends Exception {
|
|
public function __destruct() {
|
|
echo "Throwing\n";
|
|
throw new RuntimeException(__METHOD__);
|
|
}
|
|
}
|
|
try {
|
|
throw new ThrowsOnDestruct();
|
|
} catch (Exception) {
|
|
echo "Unreachable catch\n";
|
|
}
|
|
echo "Unreachable fallthrough\n";
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Throwing
|
|
|
|
Fatal error: Uncaught RuntimeException: ThrowsOnDestruct::__destruct in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): ThrowsOnDestruct->__destruct()
|
|
#1 {main}
|
|
thrown in %s on line %d
|