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.
This commit is contained in:
Mateusz Uzdowski 2012-07-20 14:04:52 +12:00
parent abc87a4f8f
commit ee2b1a9070
1 changed files with 2 additions and 1 deletions

View File

@ -172,7 +172,8 @@ class SearchForm extends Form {
// 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']);
}
/**