Skip to content
Permalink
Browse files

Trim whitespace from columns before checking for operators.

Fixes #4599
  • Loading branch information...
markstory committed Sep 14, 2014
1 parent 2698df9 commit 9e4446fe5f096d9ec729c3fd482c59000b13417c
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/Cake/Model/Datasource/DboSource.php
@@ -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;

0 comments on commit 9e4446f

Please sign in to comment.
You can’t perform that action at this time.