2019-04-11 21:49:45 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #29368.3 (The destructor is called when an exception is thrown from the constructor).
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class Foo {
|
2020-02-03 21:52:20 +00:00
|
|
|
function __construct() {
|
|
|
|
echo __METHOD__ . "\n";
|
|
|
|
}
|
|
|
|
function __destruct() {
|
|
|
|
echo __METHOD__ . "\n";
|
|
|
|
}
|
2019-04-11 21:49:45 +00:00
|
|
|
}
|
|
|
|
class Bar {
|
2020-02-03 21:52:20 +00:00
|
|
|
function __construct() {
|
|
|
|
echo __METHOD__ . "\n";
|
|
|
|
throw new Exception;
|
|
|
|
}
|
|
|
|
function __destruct() {
|
|
|
|
echo __METHOD__ . "\n";
|
|
|
|
}
|
2019-04-11 21:49:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2020-02-03 21:52:20 +00:00
|
|
|
new Foo() + new Bar();
|
2019-04-11 21:49:45 +00:00
|
|
|
} catch(Exception $exc) {
|
2020-02-03 21:52:20 +00:00
|
|
|
echo "Caught exception!\n";
|
2019-04-11 21:49:45 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
--EXPECT--
|
|
|
|
Foo::__construct
|
|
|
|
Bar::__construct
|
|
|
|
Foo::__destruct
|
|
|
|
Caught exception!
|