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

WordPress Trac noreply at wordpress.org
Sat Jun 5 00:45:45 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:
-------------------------------------------+-----------------------------

Comment (by jrf):

 FYI: this ticket was discussed in
 [https://www.youtube.com/watch?v=pweD06LsOxs today's pair programming
 session] between @hellofromTonya and me with an impromptu guest appearance
 from @dlh.

 The test in the current patch needs some additional work, which @dlh has
 graciously agreed to take on.

 The short of it is, that for a test to cover this kind of PHP cross-
 version change, the test - **without** the patch applied - should pass on
 the older PHP versions and fail on PHP 8.0 due to the fatal error. In this
 particular case, the test will/should probably also throw a warning/fail
 on PHP 7.4 due to the PHP deprecation warning being thrown.

 Once the validity of the test is confirmed, the source code patch is
 applied and the test should then pass on all supported PHP versions.

 As things were, the test was failing on older PHP versions ''without'' the
 patch applied, so didn't sufficiently safeguard the particular PHP change
 which was intended to be safeguarded.

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


More information about the wp-trac mailing list