cvs: ZendEngine2 /tests bug30162.phpt
| From: | Dmitry Stogov | Date: | Fri, 10 Jun 2005 10:46:04 +0000 |
| Subject: | cvs: ZendEngine2 /tests bug30162.phpt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-3794@lists.php.net to get a copy of this message | ||
dmitry Fri Jun 10 06:46:04 2005 EDT
Modified files:
/ZendEngine2/tests bug30162.phpt
Log:
Added test for bug #30162 (it is already fixed but test file was forgotten)
http://cvs.php.net/diff.php/ZendEngine2/tests/bug30162.phpt?r1=1.1&r2=1.2&ty=u
Index: ZendEngine2/tests/bug30162.phpt
diff -u /dev/null ZendEngine2/tests/bug30162.phpt:1.2
--- /dev/null Fri Jun 10 06:46:04 2005
+++ ZendEngine2/tests/bug30162.phpt Fri Jun 10 06:46:04 2005
@@ -0,0 +1,52 @@
+--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);
+?>
+--EXPECTF--
+Notice: Undefined variable: db in %sbug30162.php on line 35
+NULL
+object(hariCow)#1 (2) {
+ ["x"]=>
+ string(1) "x"
+ ["y"]=>
+ string(1) "y"
+}