[wp-trac] [WordPress Trac] #51559: PHP 8.0: fix fatal error "Non-static method cannot be called statically"
WordPress Trac
noreply at wordpress.org
Sat Oct 17 15:47:43 UTC 2020
#51559: PHP 8.0: fix fatal error "Non-static method cannot be called statically"
------------------------------+-----------------------------------
Reporter: jrf | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.6
Component: Text Changes | Version: trunk
Severity: normal | Keywords: has-patch commit php8
Focuses: coding-standards |
------------------------------+-----------------------------------
PHP 8 elevates the error level of a number of errors, including the `Non-
static method cannot be called statically` error.
This would previously throw a deprecation warning, but will now throw a
fatal error.
In the `Text_Diff_Engine_shell::diff()` method, the
`Text_Diff::_getTempDir()` method is called statically, which will cause a
fatal error in PHP 8.
See: https://3v4l.org/jRJK5
While this is an external library, it is no longer maintained externally,
so fixing this in Core by explicitly declaring the
`Text_Diff::_getTempDir()` method as `static`.
The method doesn't use `$this`, so changing it to `static` is safe and is
in line with how the method was documented.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51559>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list