[wp-trac] [WordPress Trac] #56127: WP_Widget contructor throws fatal ArgumentCountError in WordPress 6.0 running on PHP 8
WordPress Trac
noreply at wordpress.org
Mon Apr 24 18:47:34 UTC 2023
#56127: WP_Widget contructor throws fatal ArgumentCountError in WordPress 6.0
running on PHP 8
------------------------------------------------+--------------------------
Reporter: firefly2000 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Widgets | Version: 6.0
Severity: normal | Resolution:
Keywords: needs-patch reporter-feedback php8 | Focuses: coding-
| standards
------------------------------------------------+--------------------------
Description changed by SergeyBiryukov:
Old description:
> In WordPress core 6.0, plugins and themes that register widgets cause a
> fatal error for sites running on PHP 8.0. Here is an example:
>
> **Uncaught ArgumentCountError:** Too few arguments to function
> WP_Widget::__construct(), 0 passed
>
> A solution that is working for me is to edit line 61 of wp-includes
> /class-wp-widget-factory.php so that
> {{{
> new $widget()
> }}}
> gets 2 empty strings passed to it, e.g.
>
> {{{
> new $widget('', '')
> }}}
New description:
In WordPress core 6.0, plugins and themes that register widgets cause a
fatal error for sites running on PHP 8.0. Here is an example:
{{{
Uncaught ArgumentCountError: Too few arguments to function
WP_Widget::__construct(), 0 passed
}}}
A solution that is working for me is to edit line 61 of wp-includes/class-
wp-widget-factory.php so that
{{{
new $widget()
}}}
gets 2 empty strings passed to it, e.g.
{{{
new $widget('', '')
}}}
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56127#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list