summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-06-10 10:46:04 +0000
committerDmitry Stogov <dmitry@php.net>2005-06-10 10:46:04 +0000
commit46e4c9837d055ed247e48cd1ca90f72d0af96899 (patch)
treebbf36ce079ba3d94231f65be61a493243b700c06
parent4796fc943aa7e0c0d6e8cf9fb34bc02278991b8a (diff)
downloadphp-git-46e4c9837d055ed247e48cd1ca90f72d0af96899.tar.gz
Added test for bug #30162 (it is already fixed but test file was forgotten)
-rwxr-xr-xZend/tests/bug30162.phpt52
1 files changed, 52 insertions, 0 deletions
diff --git a/Zend/tests/bug30162.phpt b/Zend/tests/bug30162.phpt
new file mode 100755
index 0000000000..ae11f8ff8b
--- /dev/null
+++ b/Zend/tests/bug30162.phpt
@@ -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"
+}