summaryrefslogtreecommitdiff
path: root/Zend/tests/bug29368_1.phpt
blob: 09cf33438405c68ee857697687bd9938146bdaf1 (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
--TEST--
Bug #29368.1 (The destructor is called when an exception is thrown from the constructor).
--FILE--
<?php
function throwme($arg)
{
    throw new Exception;
}

class foo {
  function __construct() {
    echo "Inside constructor\n";
    throwme($this);
  }

  function __destruct() {
    echo "Inside destructor\n";
  }
}

try {
  $bar = new foo;
} catch(Exception $exc) {
  echo "Caught exception!\n";
}
?>
--EXPECT--
Inside constructor
Caught exception!