xref: /php-src/ext/reflection/tests/bug77882.phpt (revision f8d79582)
1--TEST--
2Bug #77882: Different behavior: always calls destructor
3--FILE--
4<?php
5
6class Test {
7    public function __construct() {
8        throw new Exception();
9    }
10
11    public function __destruct() {
12        echo "__destruct\n";
13    }
14}
15
16try {
17    new Test();
18} catch (Exception $e) {
19    echo "Exception\n";
20}
21try {
22    $ref = new ReflectionClass('Test');
23    $obj = $ref->newInstance();
24} catch (Exception $e) {
25    echo "Exception\n";
26}
27try {
28    $ref = new ReflectionClass('Test');
29    $obj = $ref->newInstanceArgs([]);
30} catch (Exception $e) {
31    echo "Exception\n";
32}
33
34?>
35--EXPECT--
36Exception
37Exception
38Exception
39