[wp-trac] [WordPress Trac] #52728: Widgets: Uncaught TypeError in PHP 8 when using objects for settings

WordPress Trac noreply at wordpress.org
Thu May 27 02:10:47 UTC 2021


#52728: Widgets: Uncaught TypeError in PHP 8 when using objects for settings
-------------------------------------------+-----------------------------
 Reporter:  dlh                            |       Owner:  SergeyBiryukov
     Type:  defect (bug)                   |      Status:  reviewing
 Priority:  normal                         |   Milestone:  5.8
Component:  Widgets                        |     Version:  4.3
 Severity:  normal                         |  Resolution:
 Keywords:  has-patch php8 has-unit-tests  |     Focuses:
-------------------------------------------+-----------------------------
Changes (by dlh):

 * keywords:  has-patch php8 needs-unit-tests => has-patch php8 has-unit-
               tests


Comment:

 @jrf Thanks for the thorough review! Your assessment of the situation
 makes sense to me, and [attachment:"52728.2.diff"] contains the simpler
 diff.

 As for unit tests, I'm having some trouble figuring out where to even
 start and stop. There isn't much coverage for any of the affected methods
 in `WP_Widget` on which to build.

 For now, I've added a test to verify that `WP_Widget::display_callback()`
 doesn't generate a notice or error when the underlying setting is an
 `ArrayObject`, as it does today in PHP 7.4+, and I'm happy to expand on
 that if you think there are specific scenarios worth targeting.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52728#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list