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

WordPress Trac noreply at wordpress.org
Mon Aug 2 21:54:26 UTC 2021


#53858: PHP 8.1: syntax error due to new 'readonly' property
--------------------------------------------+---------------------
 Reporter:  haosun                          |       Owner:  (none)
     Type:  defect (bug)                    |      Status:  new
 Priority:  normal                          |   Milestone:  5.9
Component:  General                         |     Version:
 Severity:  normal                          |  Resolution:
 Keywords:  php81 needs-dev-note has-patch  |     Focuses:
--------------------------------------------+---------------------

Comment (by SergeyBiryukov):

 Replying to [comment:12 jrf]:
 > 2. While this will be even more difficult to search for, the function
 ''may'' also be used as a callback via `add_filter()`. To be honest, I
 wouldn't be surprised if that type of use exists in the WP Core codebase,
 though I haven't done a search for it (yet). In that case, in PHP 8.1, I
 expect this will result in a run-time fatal error when `readonly` gets
 called via `apply_filters()`.

 Just noting that I have not found any instances of using the function in
 core.

 Replying to [comment:19 jrf]:
 > Are there any tests covering this method which need updating ? And if
 no: would now be a good time to add them ?

 There are some tests for `selected()` and `checked()`, see [48907] /
 #51166.

 `disabled()` and `readonly()` don't seem to have any tests. Would be a
 great time to add them :)

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


More information about the wp-trac mailing list