[wp-trac] [WordPress Trac] #54996: PHP8.1 Deprecated in WordPress 6.0-alpha-52650
WordPress Trac
noreply at wordpress.org
Sun Jan 30 12:54:24 UTC 2022
#54996: PHP8.1 Deprecated in WordPress 6.0-alpha-52650
----------------------------+-----------------------------
Reporter: haozi | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: major | Keywords: has-patch
Focuses: administration |
----------------------------+-----------------------------
In PHP8.1,Implicit incompatible float to int conversion is deprecated.
Because of it, wordpress will throw a PHP Deprecated in page footer like:
{{{
Deprecated: Implicit conversion from float 0.009382247924804688 to int
loses precision in /www/wwwroot/mysite/wp-includes/pomo/plural-forms.php
}}}
To fix it, I try to add (int) in /wp-includes/pomo/plural-forms.php on
line 242-248 like:
{{{#!php
public function get( $num ) {
if ( isset( $this->cache[ (int) $num ] ) ) {
return $this->cache[ $num ];
}
$this->cache[ (int) $num ] = $this->execute( (int)
$num );
return $this->cache[ (int) $num ];
}
}}}
It works well!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54996>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list