summaryrefslogtreecommitdiff
path: root/Zend/tests/bug30162.phpt
blob: a011292a13cb574522fb4c1530a49f4f51382d9e (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--TEST--
Bug #30162 (Catching exception in constructor couses lose of $this)
--FILE--
<?php
class FIIFO {

	public function __construct() {
		$this->x = "x";
		throw new Exception;
	}

}

class hariCow extends FIIFO {

	public function __construct() {
		try {
			parent::__construct();
		} catch(Exception $e) {
		}
		$this->y = "y";
		try {
			$this->z = new FIIFO;
		} catch(Exception $e) {
		}
	}
	
	public function __toString() {
		return "Rusticus in asino sedet.";
	}

}

try {
	$db = new FIIFO();
} catch(Exception $e) {
}
var_dump($db);

$db = new hariCow;

var_dump($db);
?>
===DONE===
--EXPECTF--
Notice: Undefined variable: db in %sbug30162.php on line 35
NULL
object(hariCow)#%d (2) {
  ["x"]=>
  string(1) "x"
  ["y"]=>
  string(1) "y"
}
===DONE===