Edit report at https://bugs.php.net/bug.php?id=49348&edit=1
ID: 49348 Updated by: s...@php.net Reported by: BelStudent at yandex dot ru Summary: Uninitialized ++$foo->bar; does not cause a notice (but ++$bar; does!) Status: Assigned Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 5.*, 6 Assigned To: stas Block user comment: N Private report: N New Comment: The problem here is that get_property_ptr_ptr does not produce notices. It doesn't because it does not know the fetch type - in some cases it's BP_VAR_W, then it shouldn't produce notice, in some it's BP_VAR_RW and then it should. However get_property_ptr_ptr doesn't have a parameter to pass this info. Looks like such parameter needs to be added... Previous Comments: ------------------------------------------------------------------------ [2009-09-01 08:41:52] sjo...@php.net I was talking about this: http://svn.php.net/viewvc/php/php-src/trunk/Zend/zend_execute.c?revision=286362&view=markup#l251 With ++$foo, type is BP_VAR_RW, which makes sense and gives a notice. With ++$this->foo, it is BP_VAR_W. ------------------------------------------------------------------------ [2009-08-31 22:12:10] j...@php.net # svn log -r100312 zend_object_handlers.c ------------------------------------------------------------------------ r100312 | stas | 2002-10-20 22:22:04 +0300 (Sun, 20 Oct 2002) | 2 lines looks like this message should go --- Stas, care to explain? Uncommenting that will bring back the notice. And Sjoerd, what did you mean with that comment..? ------------------------------------------------------------------------ [2009-08-27 21:06:36] sjo...@php.net In _get_zval_cv_lookup(), type is BP_VAR_W, while it should be BP_VAR_RW for the example code. ------------------------------------------------------------------------ [2009-08-25 08:18:09] j...@php.net Reopened, Gwynne's arguments are rock solid. :) ------------------------------------------------------------------------ [2009-08-25 07:13:46] gwy...@php.net Actually, this is a valid problem; the problem described by bug #21008 is a different issue. There seems to be some confusion as to whether it should be fixed or not, but it's neither a duplicate nor bogus. Specifically, bug #21008 describes an issue with setting a variable to a value, where this report describes an issue with updating a variable. These are two distinct operations, and are handled differently. More to the point, the following code throws a notice: <?php ++$n; ?> That the code described by this bug doesn't is an inconsistency. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=49348 -- Edit this bug report at https://bugs.php.net/bug.php?id=49348&edit=1