summaryrefslogtreecommitdiff
path: root/Zend/tests/bug29368.phpt
blob: ae6139efc631e7ed1e46bc9c26ab8fb7b7ce04ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
Bug #29368 (The destructor is called when an exception is thrown from the constructor)
--FILE--
<?php

class Foo
{
    function __construct()
    {
        echo __METHOD__ . "\n";
        throw new Exception;
    }
    function __destruct()
    {
        echo __METHOD__ . "\n";
    }
}

try
{
    $bar = new Foo;
} catch(Exception $exc)
{
    echo "Caught exception!\n";
}

unset($bar);

?>
--EXPECT--
Foo::__construct
Caught exception!