mirror of
https://github.com/php/php-src.git
synced 2024-10-21 00:12:34 +00:00
39 lines
442 B
Plaintext
39 lines
442 B
Plaintext
|
--TEST--
|
||
|
Catching an exception in a constructor fired form a static method
|
||
|
--FILE--
|
||
|
<?php
|
||
|
|
||
|
class MyObject
|
||
|
{
|
||
|
function fail()
|
||
|
{
|
||
|
throw new Exception();
|
||
|
}
|
||
|
|
||
|
function __construct()
|
||
|
{
|
||
|
self::fail();
|
||
|
echo __METHOD__ . "() Must not be reached\n";
|
||
|
}
|
||
|
|
||
|
function __destruct()
|
||
|
{
|
||
|
echo __METHOD__ . "() Must not be called\n";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
try
|
||
|
{
|
||
|
new MyObject();
|
||
|
}
|
||
|
catch(Exception $e)
|
||
|
{
|
||
|
echo "Caught\n";
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
===DONE===
|
||
|
--EXPECT--
|
||
|
Caught
|
||
|
===DONE===
|