[wp-trac] [WordPress Trac] #57739: PHP 8.1 compatibility

WordPress Trac noreply at wordpress.org
Thu Feb 16 22:02:53 UTC 2023


#57739: PHP 8.1 compatibility
--------------------------+-----------------------------
 Reporter:  bcm924        |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:
 Severity:  major         |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 In our case, our website (latest WP release) was throwing fatal errors
 when trying to switch to PHP 8.1. After much digging, we found the issue
 to be in the wp-includes/class-wp-widget-factory.php file, line 62. The
 line was formerly:

 {{{#!php
 <?php
 $this->widgets[ $widget ] = new $widget();
 }}}

 And to fix the site, we modified the line to be as follows:

 {{{#!php
 <?php
 $this->widgets[ $widget ] = new $widget( $widget, $widget );
 }}}

 This completely resolved the issue in our case. Please update the core
 file to reflect this change in the move toward PHP 8+ compatibility.
 Thanks.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57739>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list