Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#51645 closed defect (bug) (fixed)

Undefined index: echo in core files

Reported by: kellybleck's profile kellybleck Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.5.2 Priority: normal
Severity: trivial Version: 5.2
Component: General Keywords: has-patch fixed-major
Focuses: template Cc:

Description

Updated to WordPress 5.5.1, and have my WP_DEBUG set to output to an error file. There is one that crops up all the time -

[22-Sep-2020 03:39:44 UTC] PHP Notice: Undefined index: echo in /var/www/httpdocs/wp-includes/general-template.php on line 350

Attachments (1)

51645.diff (404 bytes) - added by whyisjake 4 years ago.

Download all attachments as: .zip

Change History (10)

#1 @davidbaumwald
4 years ago

  • Focuses template added
  • Version changed from 5.5.1 to 5.5

Welcome to Trac, @kellybleck! This does indeed look like something that should be investigated.

In 5.2, the $args parameter was added and made filterable with the search_form_args filter. It looks like the filtered $args could unset the echo property and throw this notice when if ( $args['echo'] ) { is run.

My guess is that a simple isset sanity check would work here.

Last edited 4 years ago by davidbaumwald (previous) (diff)

#2 @davidbaumwald
4 years ago

  • Version changed from 5.5 to 5.2

Actually, this goes back to 5.2.

@whyisjake
4 years ago

#3 @whyisjake
4 years ago

  • Keywords has-patch dev-feedback added
  • Milestone changed from Awaiting Review to 5.5.2

#4 @SergeyBiryukov
4 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @SergeyBiryukov
4 years ago

I think a better fix here would be to ensure that all the default values are always set:

$args = wp_parse_args( $args, apply_filters( 'search_form_args', $defaults ) );

That way we don't have to check whether each individual argument exists.

The same approach is used in comment_form(), wp_login_form(), and register_sidebar().

#6 @SergeyBiryukov
4 years ago

On second thought, that does not fix the issue and changes the behavior of the filter to no longer receive custom values. Taking another look.

#7 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 49355:

General: Ensure that filtered arguments in get_search_form() contain all required default values.

Props kellybleck, davidbaumwald, whyisjake, SergeyBiryukov.
Fixes #51645.

#8 @SergeyBiryukov
4 years ago

  • Keywords fixed-major added; dev-feedback removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening for backporting to the 5.5 branch.

#9 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 49356:

General: Ensure that filtered arguments in get_search_form() contain all required default values.

Props kellybleck, davidbaumwald, whyisjake, SergeyBiryukov.
Merges [49355] to the 5.5 branch.
Fixes #51645.

Note: See TracTickets for help on using tickets.