Browse files

BUG Check for the parameter existence.

The specific situation is if the 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 ee2b1a9070e4c49466b8a6c9f98bf7de23874934
Showing with 2 additions and 1 deletion.
  1. +2 −1 code/search/SearchForm.php
@@ -172,7 +172,8 @@ public function getSearchQuery($data = null) {
// legacy usage: $data was defaulting to $_REQUEST, parameter not passed in 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']);

0 comments on commit ee2b1a9

Please sign in to comment.