Skip to content

Commit

Permalink
Filtering empty params out of the query string.
Browse files Browse the repository at this point in the history
This fixes errors caused by cahnges in cake 3.2.3
  • Loading branch information
lorenzo committed Feb 22, 2016
1 parent a67c2ac commit 055cddb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Controller/Component/PrgComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ public function conversion($redirect = true)
return null;
}
if ($redirect) {
$params = $this->request->data;

foreach ($params as $k => $param) {
if (is_string($param) && strlen($param) === 0) {
unset($params[$k]);
}
}

return $this->_registry->getController()->redirect(
$this->request->params['pass'] + ['?' => $this->request->data]
$this->request->params['pass'] + ['?' => $params]
);
}
return null;
Expand Down
5 changes: 5 additions & 0 deletions src/Model/Behavior/SearchBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public function findSearch(Query $query, array $options)
*/
public function filterParams($params)
{
foreach ($params as $k => $param) {
if (is_string($param) && strlen($param) === 0) {
unset($params[$k]);
}
}
return ['search' => array_intersect_key($params, $this->_getAllFilters())];
}

Expand Down

0 comments on commit 055cddb

Please sign in to comment.