mirror of
https://github.com/php/php-src.git
synced 2026-10-28 17:56:50 +08:00
32 lines
452 B
PHP
32 lines
452 B
PHP
--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 $e::class, ': ', $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Test::__construct(Hello)
|
|
Exception: Hello
|