[wp-trac] [WordPress Trac] #60875: Handler proposal for known dynamic properties that are initialized and set late only when getting its value

WordPress Trac noreply at wordpress.org
Mon Apr 29 13:54:04 UTC 2024


#60875: Handler proposal for known dynamic properties that are initialized and set
late only when getting its value
----------------------------+--------------------------------
 Reporter:  hellofromTonya  |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  6.6
Component:  General         |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  php82           |     Focuses:  php-compatibility
----------------------------+--------------------------------

Comment (by antonvlasenko):

 One thing I stumbled upon while working on a new PR that implements this
 proposal is the need to be careful when adding protected and private
 properties to existing classes that previously only contained public
 properties (e.g., didn't have any protected/private properties before).

 PHP adds a null byte character to the names of protected and private
 properties when converting an object to an array, and the
 `simplexml_load_string()` function throws an error as it can't handle the
 null byte character.

 This code snippet illustrates this behavior: https://3v4l.org/XQL4f#v8.3.6
 (change the `WP_Term::$data`'s visibility to private or protected to
 reproduce the issue).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60875#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list