[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
Fri Jul 1 18:40:45 UTC 2022


#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:  blocker           |   Keywords:  needs-patch
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 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>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list