[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:46:07 UTC 2021


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

Comment (by jrf):

 Thanks @SergeyBiryukov !

 For the backport, I'd like to suggest just adding the `wp_readonly()`
 function declaration to the `general-template.php` file. That way
 plugins/themes which support multiple WP versions don't all need to
 polyfill it.
 The rest of the patch does not need backporting.

 So, basically just this:
 {{{#!php
 <?php
 function wp_readonly( $readonly, $current = true, $echo = true ) {
     return readonly( $readonly, $current, $echo );
 }
 }}}

 Not sure what the `@since` tag should read in the docblock though...

 Suggestion: backport for WP 5.2 - 5.8.

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


More information about the wp-trac mailing list