[wp-trac] [WordPress Trac] #53858: PHP 8.1: syntax error due to new 'readonly' property

WordPress Trac noreply at wordpress.org
Mon Aug 9 17:19:35 UTC 2021


#53858: PHP 8.1: syntax error due to new 'readonly' property
-------------------------------------------------+-------------------------
 Reporter:  haosun                               |       Owner:  jrf
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  5.9
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  php81 needs-dev-note has-patch       |     Focuses:
  early has-unit-tests commit                    |
-------------------------------------------------+-------------------------
Changes (by SergeyBiryukov):

 * status:  accepted => closed
 * resolution:   => fixed


Comment:

 In [changeset:"51586" 51586]:
 {{{
 #!CommitTicketReference repository="" revision="51586"
 Code Modernization: Rename the `readonly()` function to `wp_readonly()`.

 Since PHP 8.1, `readonly` is a reserved keyword and cannot be used as a
 function name.

 In order to avoid PHP parser errors, the `readonly()` function was
 extracted to a separate file and is now only included conditionally on PHP
 < 8.1.

 This commit also:
 * Moves the tests for the `__checked_selected_helper()` function and all
 the related functions to their own file.
 * Switches to named data providers. This makes the output when using the
 `--testdox` option more descriptive and is helpful when trying to debug
 which data set from a data provider failed the test.
 * Improves the tests in question to make them feature-complete and expand
 test coverage.

 Props jrf, ayeshrajans, haosun, knutsp, swissspidy, SergeyBiryukov.
 Fixes #53858.
 }}}

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


More information about the wp-trac mailing list