Skip to content
This repository
Browse code

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...
commit ee2b1a9070e4c49466b8a6c9f98bf7de23874934 1 parent abc87a4
Mateusz U authored July 20, 2012

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  code/search/SearchForm.php
3  code/search/SearchForm.php
@@ -172,7 +172,8 @@ public function getSearchQuery($data = null) {
172 172
 		// legacy usage: $data was defaulting to $_REQUEST, parameter not passed in doc.silverstripe.org tutorials
173 173
 		if(!isset($data)) $data = $_REQUEST;
174 174
 		
175  
-		return Convert::raw2xml($data['Search']);
  175
+		// The form could be rendered without the search being done, so check for that.
  176
+		if (isset($data['Search'])) return Convert::raw2xml($data['Search']);
176 177
 	}
177 178
 	
178 179
 	/**

0 notes on commit ee2b1a9

Please sign in to comment.
Something went wrong with that request. Please try again.