File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug30162.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (12 years, 4 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--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===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>