php-src/tests/classes/ctor_failure.phpt
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00

32 lines
478 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 'Caught ' . get_class($e) . '(' . $e->getMessage() . ")\n";
}
?>
--EXPECT--
Test::__construct(Hello)
Caught Exception(Hello)