rfc:propertygetsetsyntax-implementation-details

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:propertygetsetsyntax-implementation-details [2013/01/16 21:39] – Rewrite to current state cpriestrfc:propertygetsetsyntax-implementation-details [2013/01/21 19:38] nikic
Line 1: Line 1:
 ====== Internal Implementation Details for Property Accessors ====== ====== Internal Implementation Details for Property Accessors ======
   * Version: 1.2   * Version: 1.2
-  * Updated: 2013-01-16+  * Updated: 2013-01-17
   * Author: Clint Priest <phpdev at zerocue dot com>   * Author: Clint Priest <phpdev at zerocue dot com>
   * Contributors: Nikita Popov   * Contributors: Nikita Popov
Line 43: Line 43:
 </code> </code>
  
-An additional byte was added to zend_function to specify the purpose of the function: +The ''zend_function''of the accessors have the ''ZEND_ACC_ACCESSOR'' flag set.
-<code c> +
-zend_uchar purpose; +
-</code> +
- +
-This was in lieu of using 4 additional fn_flag values for which there was not room.  There are presently five states purpose can be in, they are: +
-<code c> +
-#define ZEND_FNP_UNDEFINED 0 /* No special purpose function */ +
-#define ZEND_FNP_PROP_GETTER 1 /* Special purpose accessor: getter */ +
-#define ZEND_FNP_PROP_SETTER 2 /* Special purpose accessor: setter */ +
-#define ZEND_FNP_PROP_ISSETTER 3 /* Special purpose accessor: issetter */ +
-#define ZEND_FNP_PROP_UNSETTER 4 /* Special purpose accessor: unsetter */ +
-</code> +
- +
-All non-accessor functions have their purpose initialized to 0.+
  
 ==== Compilation Changes ==== ==== Compilation Changes ====
Line 73: Line 59:
 the property and if so checks that there is an accessor for the specific action (read/write, etc) being performed and the property and if so checks that there is an accessor for the specific action (read/write, etc) being performed and
 handles the situation accordingly. handles the situation accordingly.
 +
  
 Much of the pre/post magic call code that %%__get/__set/__isset/__unset%% used was refactored and centralized into their respective zend_std_call_*() functions. Much of the pre/post magic call code that %%__get/__set/__isset/__unset%% used was refactored and centralized into their respective zend_std_call_*() functions.
 The new accessors also utilize these functions so that all pre/post condition handling is the same for accessors as they are for the magics. The new accessors also utilize these functions so that all pre/post condition handling is the same for accessors as they are for the magics.
  
-At this time, accessors also use the same recursive guarding mechanism to protect from recursion, however in the case of recursion with accessors + 
-a warning will be emitted if recursion is detected and that recursion is not called from the context of the accessor.+A new function flag was added ''ZEND_ACC_CALL_GUARD'' which flags a function as "being called and guarded," this was necessary to allow for parent 
 +accessors being able to be properly called. In the case of recursion with accessors a warning will be emitted if recursion is detected and that  
 +recursion is not called from the context of the validly scoped accessor. 
  
 For example a get accessor is allowed to get it's own value and does not produce a warning, but instead the ordinary property access routines occur while attempts to read that property from a context other than the get accessor will emit a warning and the value will be returned as NULL. For example a get accessor is allowed to get it's own value and does not produce a warning, but instead the ordinary property access routines occur while attempts to read that property from a context other than the get accessor will emit a warning and the value will be returned as NULL.
 +
  
  * Error producing lines have been modified to produce a useful error report.  For example: Cannot override final property getter TimePeriod::$Hours  * Error producing lines have been modified to produce a useful error report.  For example: Cannot override final property getter TimePeriod::$Hours
rfc/propertygetsetsyntax-implementation-details.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1