Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BUG Check for the parameter existence.
The specific situation is if the SearchForm.ss is overriden, and the
$SearchQuery parameter is used in the template. This will throw a Notice
in case the form is rendered without searching.
  • Loading branch information
mateusz committed Jul 20, 2012
1 parent abc87a4 commit ee2b1a9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/search/SearchForm.php
Expand Up @@ -172,7 +172,8 @@ public function getSearchQuery($data = null) {
// legacy usage: $data was defaulting to $_REQUEST, parameter not passed in doc.silverstripe.org tutorials
if(!isset($data)) $data = $_REQUEST;

return Convert::raw2xml($data['Search']);
// The form could be rendered without the search being done, so check for that.
if (isset($data['Search'])) return Convert::raw2xml($data['Search']);
}

/**
Expand Down

0 comments on commit ee2b1a9

Please sign in to comment.