summaryrefslogtreecommitdiff
path: root/Zend/tests/bug29368_3.phpt
blob: fafcc2a0efa8bf1ff68841460ff2d46c685df558 (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--
Bug #29368.3 (The destructor is called when an exception is thrown from the constructor).
--FILE--
<?php
class Foo {
	function __construct() {
		echo __METHOD__ . "\n";
	}
	function __destruct() {
		echo __METHOD__ . "\n";
	}
}
class Bar {
	function __construct() {
		echo __METHOD__ . "\n";
		throw new Exception;
	}
	function __destruct() {
		echo __METHOD__ . "\n";
	}
}

try {
	new Foo() + new Bar();
} catch(Exception $exc) {
	echo "Caught exception!\n";
}
?>
--EXPECT--
Foo::__construct
Bar::__construct
Foo::__destruct
Caught exception!