summaryrefslogtreecommitdiff
path: root/tests/classes/ctor_failure.phpt
blob: b7d3b64dda6b94f619bb39318562d72b1e4625df (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
33
--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===