[wp-trac] [WordPress Trac] #53635: PHP 8.1: various compatibility fixes

WordPress Trac noreply at wordpress.org
Wed Dec 15 05:32:01 UTC 2021

#53635: PHP 8.1: various compatibility fixes
 Reporter:  SergeyBiryukov                  |       Owner:  hellofromTonya
     Type:  task (blessed)                  |      Status:  accepted
 Priority:  normal                          |   Milestone:  5.9
Component:  General                         |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  php81 has-patch has-unit-tests  |     Focuses:  coding-
                                            |  standards

Comment (by jrf):

 Replying to [comment:158 noisysocks]:
 > It's a new function added in WP 5.9. Unfortunately there aren't unit
 tests for the function though there may be some E2E tests in Gutenberg
 that cover the behaviour. @youknowriad would know for sure. I wanted to
 fix this as it's a very prominent warning when visiting any page on a WP
 5.9 site running PHP 8.1 🙂

 The fact that there apparently are **no** tests, is all the more reason
 why tests should be added.

 Keep in mind that deprecation warnings are just that: deprecations. The
 behaviour of PHP is unchanged at this point, it is just a gentle warning
 that the behaviour of PHP ''will'' change in PHP 9.0.

 On a normal WP install, deprecation warnings will never show. It is only
 when someone turns `WP_DEBUG` on or fiddles with PHP `error_reporting`
 settings that these will show. So these warnings being displayed is
 nothing to be concerned about, they are part of a bigger discussion on
 input validation in Core.

 In contrast to what PHP is doing, your change, however, ''is'' a
 behavioural change, so should be covered by tests.

Ticket URL: <https://core.trac.wordpress.org/ticket/53635#comment:159>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list