[wp-trac] [WordPress Trac] #53858: PHP 8.1: syntax error due to new 'readonly' property
WordPress Trac
noreply at wordpress.org
Mon Aug 2 10:57:09 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: 4.9
Severity: normal | Resolution:
Keywords: needs-patch php81 | Focuses:
-------------------------------+---------------------
Changes (by swissspidy):
* keywords: => needs-patch php81
* version: trunk => 4.9
Comment:
There is still a possibility that this function is used ''somewhere'', so
simply removing it would be a breaking change. Hence the advocacy for an
alias.
Basically something like this:
{{{#!php
<?php
// In wp-includes/general-template.php:
/**
* Outputs the HTML readonly attribute.
*
* Compares the first two arguments and if identical marks as readonly
*
* @since 5.9.0
*
* @param mixed $readonly One of the values to compare
* @param mixed $current (true) The other value to compare if not just
true
* @param bool $echo Whether to echo or just return the string
* @return string HTML attribute or empty string
*/
function wp_readonly( $readonly, $current = true, $echo = true ) {
return __checked_selected_helper( $readonly, $current, $echo,
'readonly' );
}
// In wp-includes/deprecated.php:
if (PHP_VERSION_ID <= 80100) {
/**
* Outputs the HTML readonly attribute.
*
* Compares the first two arguments and if identical marks as
readonly
*
* @since 4.9.0
* @deprecated 5.9.0
*
* @param mixed $readonly One of the values to compare
* @param mixed $current (true) The other value to compare if not
just true
* @param bool $echo Whether to echo or just return the
string
* @return string HTML attribute or empty string
*/
function readonly( $readonly, $current = true, $echo = true ) {
_deprecated_function( __FUNCTION__, '5.9.0',
'wp_readonly()' );
return wp_readonly( $readonly, $current, $echo );
}
}
}}}
@haosun Could you perhaps test this on your setup to see if it works?
------
> Do you have any hints for this performance regression? Thanks.
I don't think it's related. You would need to run these tests multiple
times anyway to get a more meaningful result.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53858#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list