Opened 3 years ago
Closed 3 years ago
#56503 closed defect (bug) (invalid)
PHP error on get_search_form()
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | has-patch reporter-feedback close |
Focuses: | Cc: |
Description (last modified by )
When using a search form like below,
echo get_search_form();
or
get_search_form();
a php error occurs.
Warning: Undefined array key "echo" in .../wp-includes/general-template.php on line 363
Change History (5)
This ticket was mentioned in PR #3175 on WordPress/wordpress-develop by seansmyth.
3 years ago
#1
- Keywords has-patch added
#2
@
3 years ago
- Description modified (diff)
- Summary changed from PHP error on get_searh_form() to PHP error on get_search_form()
#3
@
3 years ago
- Keywords reporter-feedback added
Hi there, welcome to WordPress Trac! Thanks for the ticket and the patch!
At first I thought that while echo
is one of the default arguments for get_search_form()
, some plugin or theme could unintentionally remove it via the search_form_args
filter, but it looks like the function already protects against that, see [49355] / #51645:
// Ensure that the filtered arguments contain all required default values. $args = array_merge( $defaults, $args );
Looking at the error:
Warning: Undefined array key "echo" in .../wp-includes/general-template.php on line 363
it is worth noting that in WordPress 6.0.2, the if ( $args['echo'] )
conditional in question is line 357, not 363.
So I think the following would be helpful to move the ticket forward:
- Could you share the steps to reproduce the issue on a clean install?
- What is the version of WordPress you're using?
As it was producing a php error
Warning: Undefined array key "echo" in /general-template.php on line 363
Trac ticket: [](https://core.trac.wordpress.org/ticket/56503#ticket)