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 (13 years, 1 month 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

    1: --TEST--
    2: Bug #30162 (Catching exception in constructor couses lose of $this)
    3: --FILE--
    4: <?php
    5: class FIIFO {
    6: 
    7: 	public function __construct() {
    8: 		$this->x = "x";
    9: 		throw new Exception;
   10: 	}
   11: 
   12: }
   13: 
   14: class hariCow extends FIIFO {
   15: 
   16: 	public function __construct() {
   17: 		try {
   18: 			parent::__construct();
   19: 		} catch(Exception $e) {
   20: 		}
   21: 		$this->y = "y";
   22: 		try {
   23: 			$this->z = new FIIFO;
   24: 		} catch(Exception $e) {
   25: 		}
   26: 	}
   27: 	
   28: 	public function __toString() {
   29: 		return "Rusticus in asino sedet.";
   30: 	}
   31: 
   32: }
   33: 
   34: try {
   35: 	$db = new FIIFO();
   36: } catch(Exception $e) {
   37: }
   38: var_dump($db);
   39: 
   40: $db = new hariCow;
   41: 
   42: var_dump($db);
   43: ?>
   44: ===DONE===
   45: --EXPECTF--
   46: Notice: Undefined variable: db in %sbug30162.php on line 35
   47: NULL
   48: object(hariCow)#%d (2) {
   49:   ["x"]=>
   50:   string(1) "x"
   51:   ["y"]=>
   52:   string(1) "y"
   53: }
   54: ===DONE===

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