Make WordPress Core

Opened 3 years ago

Last modified 12 months ago

#53449 new defect (bug)

Child Walker classes change the $args parameter data type and default value signatures for start_el and end_el

Reported by: hellofromtonya's profile hellofromTonya Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Menus Keywords: php80
Focuses: Cc:


The following Walker classes have code smells for changing the data type of the $args parameter when extending from the Walker::start_el and end_el:

  • Walker_Nav_Menu
  • Walker_Nav_Menu_Checklist
  • Walker_Nav_Menu_Edit

What is the code smell? The parent defines the $args parameter as an array data type with a default value of an empty array. The child classes change the parameter's data type to stdClass with a default value of null.

These changes need investigation to determine if these changes are needed and why.

Change History (5)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Menus

#2 @SergeyBiryukov
3 years ago

Some history here: [13802], [14031], [14248], [19679], [25643], [38559], [45537], [47189].

There appears to be a long-time confusion about the data type of $args in these classes, due to an inconsistency with other walkers which always use it as an array.

#3 @SergeyBiryukov
3 years ago

Related: #18232, #24587, #37136, #37791, #50261.

As noted in comment:1:ticket:50261, the mismatch of the $args parameter between Walker_Nav_Menu and Walker is currently a known long-standing issue that cannot be easily fixed due to backward compatibility problems.

#4 @hellofromTonya
12 months ago

  • Keywords php80 added; php8 removed

#5 @hellofromTonya
12 months ago

Reviewed this ticket to determine if it is an incompatibility with PHP 8.0 and should be listed in the known incompatibilities for WP 6.3.

Findings: no, this is not an incompatibility issue with PHP 8.0 and therefore, the php-compatibility focus should not be added to the ticket.

Note: See TracTickets for help on using tickets.