[wp-trac] [WordPress Trac] #58898: Fix WP_Text_Diff_Renderer_Table magic methods for PHP 8.2 dynamic properties

WordPress Trac noreply at wordpress.org
Thu Aug 3 17:57:22 UTC 2023


#58898: Fix WP_Text_Diff_Renderer_Table magic methods for PHP 8.2 dynamic
properties
--------------------------------------------+-----------------------------
 Reporter:  antonvlasenko                   |       Owner:  hellofromTonya
     Type:  defect (bug)                    |      Status:  assigned
 Priority:  normal                          |   Milestone:  6.4
Component:  Administration                  |     Version:  4.0
 Severity:  normal                          |  Resolution:
 Keywords:  php82 has-patch has-unit-tests  |     Focuses:
--------------------------------------------+-----------------------------

Comment (by hellofromTonya):

 Contextual history of the magic methods:

 During WP 4.0.0, [28525] / #22234 and #27881:

 * Added the `__get()`, `__set()`, `__isset()` and `__unset()` magic
 methods.
 * Added visibility keywords for properties and methods, including
 replacing `var` with `protected` for the 3 internal properties:
 `_show_split_view`, `inline_diff_renderer`, and `_diff_threshold`.

 During WP 4.2.0, [31135] / #30891:

 * Added the `$compat_fields` property and set its value to an array of the
 3 internal properties.
 * Added the logic in each of the property magic methods to only act on the
 properties in the `$compat_fields` list.

 >The magic methods should only perform operations on a whitelisted set of
 properties, now specified in `$compat_fields`.

 These changes were made for backwards-compatibility (BC), as the
 properties were public (via `var`) and thus might have been used outside
 of WordPress Core. But the design intent was limited to only those 3
 specific properties that are listed in the `$compat_fields` property. The
 magic methods were not designed to nor did/do work on any other private,
 protected, or dynamic property.

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


More information about the wp-trac mailing list