Fixed bug #30162 (Catching exception in constructor couses lose of $this)

This commit is contained in:
Dmitry Stogov 2005-05-04 08:45:46 +00:00
parent 95629a63df
commit 37d16df05c
3 changed files with 14 additions and 7 deletions

View File

@ -20,7 +20,7 @@ class hariCow extends FIIFO {
}
public function __toString() {
return "Rusticus in asino sedet.";
return "ok\n";
}
}
@ -31,3 +31,4 @@ $db = new hariCow;
echo $db;
?>
--EXPECT--
ok

View File

@ -1890,9 +1890,11 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
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));
}

View File

@ -254,9 +254,11 @@ static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
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));
}
@ -30823,9 +30825,11 @@ static int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
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));
}