Steps to reproduce:

Search block enabled (left sidebar)
Click 'Search' button (on sidebar) without entering any keywords (search screen is displayed, no problem so far...)
Click 'Search' button (on sidebar) one more time (again without any keywords)

The following warning message is displayed:
warning: htmlspecialchars() expects parameter 1 to be string, array given in /usr/local/www/inray.com/cms/includes/bootstrap.inc on line 671.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ssb-1’s picture

Update: It looks that this problem occures even when a search keyword have been entered. Actually it always fails with error message, when searching from the search block, with search results template already displayed on main screen.

catch’s picture

Version: 6.0-beta3 » 6.x-dev

I can reproduce this:
htmlspecialchars() expects parameter 1 to be string, array given in /drupal6/includes/bootstrap.inc on line 671.

The main search/node form has validation, so no error thrown. Probably the easiest way to do this would be validate the search block form to disallow empty values (although I guess some might use empty values as a shortcut to the advanced search screen maybe?).

Or maybe it should just send an empty string? I guess it's sending NULL now?

marcingy’s picture

Just tried this on an updated version of Drupal from cvs and I can't reproduce this error at all.

ScoutBaker’s picture

I was able to duplicate this using both Beta 3 and the latest CVS. One item to note is that this does not happen if using the search function when enabled through the theme (such as Garland). You have to use the actual Search form block.

catch’s picture

Title: Searching from sidebar with no keywords gives error. » E_ALL: Search block allows empty query.
sign’s picture

Title: E_ALL: Search block allows empty query. » Searching from sidebar with no keywords gives error.

I did some testing on beta-3

The search block check_plain error occurs only when submitting on search/* pages. On any other its fine. Doesn't matter if it's an empty value or not.

After submit on search/* page it sends an empty array() as a default value to textfield element. Therefore it outputs check_plain error.

However, the search works.

ssb-1’s picture

Priority: Normal » Critical

Problem still unfixed in latest Drupal 6.0 beta 4.

Jody Lynn’s picture

Status: Active » Needs review
FileSize
575 bytes

I found the problem in search.pages.inc. search_form() expects $keys to be a string, but in search_view() $keys was being set to an array when empty.

agentrickard’s picture

Status: Needs review » Active

Testing patch.

agentrickard’s picture

Status: Active » Reviewed & tested by the community
FileSize
620 bytes

Behavior confirmed.

Patch corrects the problem.

However, patch needed to be re-rolled from root directory. http://drupal.org/patch/create

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.