mirror of
https://github.com/php/php-src.git
synced 2024-11-25 10:54:15 +08:00
34 lines
504 B
PHP
Executable File
34 lines
504 B
PHP
Executable File
--TEST--
|
|
ZE2 Do not call destructors if constructor fails
|
|
--FILE--
|
|
<?php
|
|
|
|
class Test
|
|
{
|
|
function __construct($msg) {
|
|
echo __METHOD__ . "($msg)\n";
|
|
throw new Exception($msg);
|
|
}
|
|
|
|
function __destruct() {
|
|
echo __METHOD__ . "\n";
|
|
}
|
|
}
|
|
|
|
try
|
|
{
|
|
$o = new Test('Hello');
|
|
unset($o);
|
|
}
|
|
catch (Exception $e)
|
|
{
|
|
echo 'Caught ' . get_class($e) . '(' . $e->getMessage() . ")\n";
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
Test::__construct(Hello)
|
|
Caught Exception(Hello)
|
|
===DONE===
|