[wp-trac] [WordPress Trac] #57739: Fatal error in WP_Widget_Factory::register() on PHP 8.1
WordPress Trac
noreply at wordpress.org
Tue Apr 11 07:25:07 UTC 2023
#57739: Fatal error in WP_Widget_Factory::register() on PHP 8.1
-----------------------------+---------------------
Reporter: bcm924 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.3
Component: Widgets | Version:
Severity: major | Resolution:
Keywords: has-patch php81 | Focuses:
-----------------------------+---------------------
Comment (by jrf):
Thanks @bcm924 for opening this ticket to discuss this issue.
I'm not so sure this is the correct fix.
The function signature of the `__construct()` method of each widget can be
quite different as each widget can implement this method differently and
does not necessarily have to have declared the same number of required
arguments as the parent class.
The `__construct()` method is exempt from the normal method signature
inheritance rules.
I do believe that you correctly pinpoint an underlying architectural/code
design issue here with the wdiget factory class making presumptions about
the method signature, but applying this "plaster" rather hides that issue
instead of solving it and could well result in new errors being thrown for
other widget implementations.
To solve your problem, I think more digging is needed to figure out which
individual widget class is causing the error and for that widget class to
be updated to be compatible with PHP 8.1.
A backtrace may help.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57739#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list