Navigation Menu

Skip to content

Commit

Permalink
Trim whitespace from columns before checking for operators.
Browse files Browse the repository at this point in the history
Fixes #4599
  • Loading branch information
markstory committed Sep 14, 2014
1 parent 2698df9 commit 9e4446f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Cake/Model/Datasource/DboSource.php
Expand Up @@ -2743,10 +2743,11 @@ protected function _parseKey($key, $value, Model $Model = null) {
$operatorMatch .= ')\\x20?)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is';
$bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false));

$key = trim($key);
if (strpos($key, ' ') === false) {
$operator = '=';
} else {
list($key, $operator) = explode(' ', trim($key), 2);
list($key, $operator) = explode(' ', $key, 2);

if (!preg_match($operatorMatch, trim($operator)) && strpos($operator, ' ') !== false) {
$key = $key . ' ' . $operator;
Expand Down

0 comments on commit 9e4446f

Please sign in to comment.