Bug #51758 [Opn->Fbk]: zend_object_handlers.h prescribes incorrect behavior of write property handler

From: Date: Wed, 12 May 2010 07:39:57 +0000
Subject: Bug #51758 [Opn->Fbk]: zend_object_handlers.h prescribes incorrect behavior of write property handler
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-150372@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51758&edit=1

 ID:               51758
 Updated by:       mike@php.net
 Reported by:      cataphract@php.net
 Summary:          zend_object_handlers.h prescribes incorrect behavior
                   of write property handler
-Status:           Open
+Status:           Feedback
 Type:             Bug
 Package:          Class/Object related
 Operating System: Not applicable
 PHP Version:      5.3.2

 New Comment:

Where's the value modified in zend_std_weite_property()?


Previous Comments:
------------------------------------------------------------------------
[2010-05-06 20:47:08] cataphract@php.net

I also have some doubts about the accuracy of the first part (you may
only modify it if its reference count is 1). Why 1? Since
zend_std_write_property increments the refcount before storing the zval
in the hash table, it would make more sense if it read "...its reference
count is 0". Together with issue raised in body of the bug report, it
makes me think perhaps this comment was written thinking the refcount
would be incremented before the call to write_property.

------------------------------------------------------------------------
[2010-05-06 20:40:04] cataphract@php.net

Description:
------------
zend_object_handler.h reads (line 39):

/* The following rule applies to write_property() and write_dimension()
implementations:
   If you receive a value zval in write_property/write_dimension, you
may only modify it if
   its reference count is 1.  Otherwise, you must create a copy of that
zval before making
   any changes.  You should NOT modify the reference count of the value
passed to you. */

Perhaps I'm reading the last phrase out of context, but
zend_std_write_property() changes the reference count of the passed
value in multiple places.

Test script:
---------------
Not applicable.

Expected result:
----------------
Expected either no prescription for the refcount of the passed value not
to be changed or the refcount of the passed value actually not be
changed.

Actual result:
--------------
The implementation and the header prescription are inconsistent.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51758&edit=1


Thread (1 message)

  • mike@php.net
  • Unknown Message
    • mike@php.net
« previous php.bugs (#150372) next »