(Dmitry)
- Fixed bug #30332 (zend.ze1_compatibility_mode isnt fully compatable with
array_push()). (Dmitry)
+- Fixed bug #30162 (Catching exception in constructor couses lose of $this).
+ (Dmitry)
- Fixed bug #30126 (Enhancement for error message for abstract classes).
(Marcus)
- Fixed bug #29944 (Function defined in switch, crashes). (Dmitry)
--- /dev/null
+--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"
+}
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
EG(This)->refcount--;
if (EG(This)->refcount == 1) {
- zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
+ }
+ if (should_change_scope && EG(This) != current_this) {
+ zval_ptr_dtor(&EG(This));
}
- zval_ptr_dtor(&EG(This));
} else if (should_change_scope) {
zval_ptr_dtor(&EG(This));
}