Skip to content
This repository
Browse code

FIXED: Bug in GridFieldAddExistingAutocompleter.php where an uninitia…

…lised variable would occasionally crash searches

REMOVED: Unused variable
  • Loading branch information...
commit d172e160a871a0c47107fe73b112a19b97dac75f 1 parent 1432a8e
Damian Mooyman authored
11  forms/gridfield/GridFieldAddExistingAutocompleter.php
@@ -172,14 +172,8 @@ public function getURLHandlers($gridField) {
172 172
 	 * @param SS_HTTPRequest $request 
173 173
 	 */
174 174
 	public function doSearch($gridField, $request) {
175  
-		if($this->searchList) {
176  
-			$allList = $this->searchList;
177  
-		} else {
178  
-			$allList = DataList::create($gridField->getList()->dataClass());
179  
-		}
180  
-
181  
-		$filters = array();
182  
-		$stmts = array();
  175
+		$dataClass = $gridField->getList()->dataClass();
  176
+		$allList = $this->searchList ? $this->searchList : DataList::create($dataClass);
183 177
 		
184 178
 		$searchFields = ($this->getSearchFields()) ? $this->getSearchFields() : $this->scaffoldSearchFields($dataClass);
185 179
 		if(!$searchFields) {
@@ -189,6 +183,7 @@ public function doSearch($gridField, $request) {
189 183
 		}
190 184
 
191 185
 		// TODO Replace with DataList->filterAny() once it correctly supports OR connectives
  186
+		$stmts = array();
192 187
 		foreach($searchFields as $searchField) {
193 188
 			$stmts[] .= sprintf('"%s" LIKE \'%s%%\'', $searchField, Convert::raw2sql($request->getVar('gridfield_relationsearch')));
194 189
 		}

0 notes on commit d172e16

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