From 11561aeb54b25e34957d5950ee05ac01d669f3c7 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Sun, 28 Feb 2016 21:40:34 +0100 Subject: [PATCH] Do not hang on nested parameters in search context Backport of 0b5a573 for 3.2 that does not add a new API, as required by #5056 to be semver compatible. --- admin/code/ModelAdmin.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/admin/code/ModelAdmin.php b/admin/code/ModelAdmin.php index 715132fa2..be6124ddc 100644 --- a/admin/code/ModelAdmin.php +++ b/admin/code/ModelAdmin.php @@ -226,7 +226,15 @@ abstract class ModelAdmin extends LeftAndMain { public function getList() { $context = $this->getSearchContext(); - $params = $this->request->requestVar('q'); + $params = $this->getRequest()->requestVar('q'); + + if(is_array($params)) { + $trimRecursive = function($v) use(&$trimRecursive) { + return is_array($v) ? array_map($trimRecursive, $v) : trim($v); + }; + $params = $trimRecursive($params); + } + $list = $context->getResults($params); $this->extend('updateList', $list);