Annotation of embedaddon/php/Zend/tests/bug30162.phpt, revision 1.1
1.1 ! misho 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>