Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#51645 closed defect (bug) (fixed)

Undefined index: echo in core files

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

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 6 years ago.

Download all attachments as: .zip

Change History (10)

#1 @davidbaumwald
6 years ago

  • Focuses template added
  • Version 5.5.1 → 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 6 years ago by davidbaumwald (previous) (diff)

#2 @davidbaumwald
6 years ago

  • Version 5.5 → 5.2

Actually, this goes back to 5.2.

#3 @whyisjake
6 years ago

  • Keywords has-patch dev-feedback added
  • Milestone Awaiting Review → 5.5.2

#4 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Status new → reviewing

#5 @SergeyBiryukov
6 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
6 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
6 years ago

  • Resolution → fixed
  • Status reviewing → 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
6 years ago

  • Keywords fixed-major added; dev-feedback removed
  • Resolution fixed
  • Status closed → reopened

Reopening for backporting to the 5.5 branch.

#9 @SergeyBiryukov
6 years ago

  • Resolution → fixed
  • Status reopened → 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.