On Fri, 21 Jul 2006, Dmitry Stogov wrote: > dmitry Fri Jul 21 10:32:17 2006 UTC > > Modified files: (Branch: PHP_5_2) > /ZendEngine2 zend_object_handlers.c > /ZendEngine2/tests bug32660.phpt bug37667.phpt > Log: > Changed error message (E_ERROR -> E_NOTICE) in case of indirect > modification of overloaded property.
Shouldn't this be E_STRICT instead? Derick > http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_object_handlers.c?r1=1.135.2.6.2.8&r2=1.135.2.6.2.9&diff_format=u > Index: ZendEngine2/zend_object_handlers.c > diff -u ZendEngine2/zend_object_handlers.c:1.135.2.6.2.8 > ZendEngine2/zend_object_handlers.c:1.135.2.6.2.9 > --- ZendEngine2/zend_object_handlers.c:1.135.2.6.2.8 Mon Jul 10 00:36:28 2006 > +++ ZendEngine2/zend_object_handlers.c Fri Jul 21 10:32:17 2006 > @@ -17,7 +17,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: zend_object_handlers.c,v 1.135.2.6.2.8 2006/07/10 00:36:28 helly Exp > $ */ > +/* $Id: zend_object_handlers.c,v 1.135.2.6.2.9 2006/07/21 10:32:17 dmitry > Exp $ */ > > #include "zend.h" > #include "zend_globals.h" > @@ -334,6 +334,18 @@ > > if (rv) { > retval = &rv; > + if ((type == BP_VAR_W || type == BP_VAR_RW || > type == BP_VAR_UNSET) && rv->refcount > 0) { > + zval *tmp = rv; > + > + ALLOC_ZVAL(rv); > + *rv = *tmp; > + zval_copy_ctor(rv); > + rv->is_ref = 0; > + rv->refcount = 0; > + if (Z_TYPE_P(rv) != IS_OBJECT) { > + zend_error(E_NOTICE, "Indirect > modification of overloaded property %s::$%s has no effect", zobj->ce->name, > Z_STRVAL_P(member)); > + } > + } > } else { > retval = &EG(uninitialized_zval_ptr); > } > @@ -349,9 +361,9 @@ > zval_ptr_dtor(&tmp_member); > (*retval)->refcount--; > } > - if (*retval && (type == BP_VAR_W || type == BP_VAR_RW) && > Z_TYPE_PP(retval) == IS_ARRAY) { > - zend_error(E_ERROR, "Cannot use array returned from > %s::__get('%s') in write context", zobj->ce->name, Z_STRVAL_P(member)); > - } > +// if (*retval && (type == BP_VAR_W || type == BP_VAR_RW) && > Z_TYPE_PP(retval) == IS_ARRAY) { > +// zend_error(E_ERROR, "Cannot use array returned from > %s::__get('%s') in write context", zobj->ce->name, Z_STRVAL_P(member)); > +// } > return *retval; > } > > http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug32660.phpt?r1=1.1&r2=1.1.6.1&diff_format=u > Index: ZendEngine2/tests/bug32660.phpt > diff -u ZendEngine2/tests/bug32660.phpt:1.1 > ZendEngine2/tests/bug32660.phpt:1.1.6.1 > --- ZendEngine2/tests/bug32660.phpt:1.1 Thu Jun 23 11:04:35 2005 > +++ ZendEngine2/tests/bug32660.phpt Fri Jul 21 10:32:17 2006 > @@ -28,9 +28,12 @@ > print_r($a); > ?> > --EXPECTF-- > +Notice: Indirect modification of overloaded property A::$whatever has no > effect in %sbug32660.php on line 20 > A Object > ( > - [q] => long > + [q] => 3 > ) > > +Notice: Indirect modification of overloaded property A::$whatever has no > effect in %sbug32660.php on line 23 > + > Fatal error: Cannot assign by reference to overloaded object in > %sbug32660.php on line 23 > http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug37667.phpt?r1=1.2.2.2&r2=1.2.2.3&diff_format=u > Index: ZendEngine2/tests/bug37667.phpt > diff -u ZendEngine2/tests/bug37667.phpt:1.2.2.2 > ZendEngine2/tests/bug37667.phpt:1.2.2.3 > --- ZendEngine2/tests/bug37667.phpt:1.2.2.2 Mon Jul 10 00:36:28 2006 > +++ ZendEngine2/tests/bug37667.phpt Fri Jul 21 10:32:17 2006 > @@ -30,7 +30,7 @@ > --EXPECTF-- > string(3) "bar" > > -Notice: Undefined offset: 2 in %sbug37667.php on line %d > +Notice: Undefined offset: 2 in %sbug37667.php on line 16 > NULL > object(Test)#%d (1) { > ["property:protected"]=> > @@ -40,4 +40,14 @@ > } > } > > -Fatal error: Cannot use array returned from Test::__get('property') in write > context in %sbug37667.php on line %d > +Notice: Indirect modification of overloaded property Test::$property has no > effect in %sbug37667.php on line 20 > + > +Notice: Indirect modification of overloaded property Test::$property has no > effect in %sbug37667.php on line 21 > +object(Test)#%d (1) { > + ["property:protected"]=> > + array(1) { > + ["foo"]=> > + string(3) "bar" > + } > +} > +===DONE=== > > -- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php