RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c php-src NEWS
| From: | Dmitry Stogov | Date: | Mon, 31 Oct 2005 20:27:52 +0000 |
| Subject: | RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c php-src NEWS | ||
| References: | 1 | Groups: | php.zend-engine.cvs |
| Request: | Send a blank email to php-zend-engine-cvs+get-4301@lists.php.net to get a copy of this message | ||
The problem is conceptual.
Before this patch PHP looked for EG(exception) after calling constructor and
disabled destructor calling.
if (EG(exception) && ctor_opline) {
if (RETURN_VALUE_USED(ctor_opline)) {
EG(This)->refcount--;
}
if (EG(This)->refcount == 1) {
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
}
}
Now the object also stored in backtrace so refcount is more then 1.
Probably we can check refcount with 2, but I am not sure that is a proper
way.
Thanks. Dmitry.
> -----Original Message-----
> From: Zeev Suraski [mailto:zeev@zend.com]
> Sent: Monday, October 31, 2005 11:07 PM
> To: Dmitry Stogov
> Cc: 'Sebastian Bergmann'; zend-engine-cvs@lists.php.net; Andi
> Gutmans; Marcus Boerger; Ilia Alshanetsky
> Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 /
> zend_builtin_functions.c php-src NEWS
>
>
> Some patches look safer than they really are :I
>
> Dmitry - did you look into the bugs? Are they solvable or do
> we have a
> conceptual problem with this patch?
>
> Zeev
>
> At 21:28 31/10/2005, Dmitry Stogov wrote:
> >Hi Sebastian,
> >
> >The following tests are failed after this patch.
> >First two are probably the same bug and it is CRITICAL.
> >The rest is not critical and tests themselves can be fixed.
> >
> >ZE2 Do not call destructors if constructor fails
> >[tests/classes/ctor_failure.phpt]
> >Bug #29368 (The destructor is called when an exception is
> thrown from
> >the
> >constructor) [Zend/tests/bug29368.phpt]
> >
> >Bug #30162 (Catching exception in constructor couses lose of $this)
> >[Zend/tests/bug30162.phpt] Test 3: Exception Test
> >[ext/dom/tests/dom003.phpt]
> >Test: setAttributeNode() [ext/dom/tests/dom_set_attr_node.phpt]
> >
> >Thanks. Dmitry
> >
> > > -----Original Message-----
> > > From: Sebastian Bergmann [mailto:sebastian@php.net]
> > > Sent: Saturday, October 29, 2005 12:09 AM
> > > To: zend-engine-cvs@lists.php.net
> > > Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2 /
> > > zend_builtin_functions.c php-src NEWS
> > >
> > >
> > > sebastian Fri Oct 28 16:08:30 2005 EDT
> > >
> > > Modified files:
> > > /php-src NEWS
> > > /ZendEngine2 zend_builtin_functions.c
> > > Log:
> > > Add an additional field $frame['object'] to the result array of
> > > debug_backtrace() that contains a reference to the
> respective object
> > > when the frame was called from an object. Patch has been
> reviewed by
> > > Andi, Zeev, and Marcus. I will coordinate with Ilia on
> merging it to
> > > the PHP_5_1 branch after PHP 5.1.0 has been released.
> > >
> > >
> > > http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2072&r2=1.2073&ty=u
> > > Index: php-src/NEWS
> > > diff -u php-src/NEWS:1.2072 php-src/NEWS:1.2073
> > > --- php-src/NEWS:1.2072 Thu Oct 20 15:35:14 2005
> > > +++ php-src/NEWS Fri Oct 28 16:08:05 2005
> > > @@ -22,4 +22,7 @@
> > > the part of haystack before or after first occurence
> of needle.
> > > (Johannes)
> > > - Added possibility to check in which extension an internal
> > > function was
> > > defined using reflection API. (Johannes)
> > > +- Added an additional field $frame['object'] to the
> result array of
> > > + debug_backtrace() that contains a reference to the
> > > respective object
> > > +when the
> > > + frame was called from an object. (Sebastian)
> > > - Fixed bug #34286 (__toString() behavior is inconsistent).
> > > (Marcus)
> > >
> > > http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions
> >.c?r1=1.294&r2=1.295&ty=u
> >Index: ZendEngine2/zend_builtin_functions.c
> >diff -u ZendEngine2/zend_builtin_functions.c:1.294
> >ZendEngine2/zend_builtin_functions.c:1.295
> >--- ZendEngine2/zend_builtin_functions.c:1.294 Fri Sep 9 02:47:14
> >2005
> >+++ ZendEngine2/zend_builtin_functions.c Fri Oct 28
> 16:08:25 2005
> >@@ -17,7 +17,7 @@
> >
> >+------------------------------------------------------------
> ----------+
> > */
> >
> >-/* $Id: zend_builtin_functions.c,v 1.294 2005/09/09 06:47:14 dmitry
> >Exp $ */
> >+/* $Id: zend_builtin_functions.c,v 1.295 2005/10/28
> 20:08:25 sebastian
> >+Exp $ */
> >
> > #include "zend.h"
> > #include "zend_API.h"
> >@@ -2005,6 +2005,9 @@
> > dup =
> >zend_get_object_classname(ptr->object, &class_name, &class_name_len
> >TSRMLS_CC);
> >
> add_assoc_text_ex(stack_frame,
> >"class", sizeof("class"), class_name, dup);
> > }
> >+ add_assoc_zval_ex(stack_frame,
> >+ "object",
> >sizeof("object"), ptr->object);
> >+ ptr->object->refcount++;
> >+
> >
> add_assoc_ascii_string_ex(stack_frame,
> >"type", sizeof("type"), "->", 1);
> > } else if
> >(ptr->function_state.function->common.scope) {
> > add_assoc_textl_ex(stack_frame,
> >"class", sizeof("class"),
> >ptr->function_state.function->common.scope->name,
> >ptr->function_state.function->common.scope->name_length, 1);
> >
> >--
> >Zend Engine CVS Mailing List (http://cvs.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
>