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

WordPress Trac noreply at wordpress.org
Mon Aug 2 08:56:24 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:  Future Release
Component:  General            |     Version:  4.9
 Severity:  normal             |  Resolution:
 Keywords:  php81 needs-patch  |     Focuses:
Changes (by swissspidy):

 * keywords:   => php81 needs-patch
 * version:  trunk => 4.9
 * milestone:  Awaiting Review => Future Release


 Interestingly I couldn't find any use of this function in WordPress nor
 any WordPress plugin or theme (via https://wpdirectory.net/). Looks like
 it was just added out of convenience/consistency in #16886.

 Renaming to `wp_readonly()` and making `readonly()` an alias of that on
 PHP < 8.1 sounds reasonable as long as it doesn't cause syntax errors
 anymore. It should be marked as deprecated though.

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

More information about the wp-trac mailing list