[wp-trac] [WordPress Trac] #56034: PHP 8.2: proposal for handling unknown dynamic properties deprecations

WordPress Trac noreply at wordpress.org
Tue Aug 16 18:17:07 UTC 2022


#56034: PHP 8.2: proposal for handling unknown dynamic properties deprecations
-------------------------------+-----------------------------
 Reporter:  jrf                |       Owner:  hellofromTonya
     Type:  task (blessed)     |      Status:  accepted
 Priority:  normal             |   Milestone:  6.1
Component:  General            |     Version:
 Severity:  normal             |  Resolution:
 Keywords:  php82 needs-patch  |     Focuses:
-------------------------------+-----------------------------

Comment (by jrf):

 Summary of today's livestream:

 === Regarding the traits:

 * Together we have a semi-working proof of concept of the
 ForbidDynamicProperties trait with a huge amount of test (not all passing
 yet) and more tests are still needed.
 * There are concerns about the performance impact of the current solution.
 This will further investigation.
 * If we can smooth out the issues/failing tests, we can apply the same
 principle to the DeprecateDynamicProperties trait.
 * As this was nowhere near as straight forward as we originally thought,
 we've discussed and propose to publish these traits in a separate package
 - DynamicPropertyUtils - for WP to use as an external dependency. Consider
 this a give-back to the wider PHP community as a lot more projects will
 need to solve this issue in the near future.

 Actions items:
 * Get a repo opened for the package within the WP GH organisation.
 * @markjaquith and me will then publish the code we created and work can
 then collaboratively continue on smoothing things out.

 === Regarding the pre-existing magic methods in WP Core:

 * We've looked at and did an initial review of all of them. Luckily it is
 a limited list.
 * All of them need work, a number them can/should be removed, but need to
 safeguard that change with tests (and possible some changes/reverting of
 declared property visibilities). The work on this should include
 investigating whether and if so, how the properties "handled" in the magic
 methods are used by plugins/themes.
 * All of need additional tests.
 * We also would like to investigate/work on some patterns as examples for
 how to implement magic methods correctly. We'd also like to see if we can
 transform those patterns into re-usable traits, in which case, they'd be
 added to the separate package mentioned above.

 === Regarding timing:

 Considering our current findings and the potential impact of any changes
 on Core and the wider extender field, we very much recommend for this
 ticket to move to the 6.2 milestone and be marked as early.

 Work should continue on creating the patches over the next month or two,
 to ensure they are ready and reviewed ahead of the 6.2 branch opening for
 commit. They should then be committed as soon as the branch opens to allow
 for maximum exposure of these changes to real-world testing.

 === In the interim....

 **Open question:**
 Should we - TEMPORARILY - add the `#[AllowDynamicProperties]` attribute to
 all (parent) classes in WP Core for the time being to reduce the volume of
 notices being logged in error logs for sites using those logs ?

 Once we have the ''proper'' patches ready, we can then decide if and if
 so, when to remove the attributes.

 Please leave opinions on this in this thread.

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


More information about the wp-trac mailing list