Fix that the queryfilter parser cannot handle integer values

This commit is contained in:
Johannes Meyer 2014-03-21 12:54:25 +01:00
parent b22f3f6b47
commit 862b50264a
2 changed files with 2 additions and 2 deletions

View File

@ -472,7 +472,7 @@ abstract class BaseQuery implements Filterable
Node::createOperatorNode($splitted[0], $splitted[1], is_string($parameter)); Node::createOperatorNode($splitted[0], $splitted[1], is_string($parameter));
return Node::createOperatorNode(Node::OPERATOR_EQUALS, $splitted[0], $parameter); return Node::createOperatorNode(Node::OPERATOR_EQUALS, $splitted[0], $parameter);
} elseif (count($splitted) === 3) { } elseif (count($splitted) === 3) {
if (trim($splitted[2]) === '?' && is_string($parameter)) { if (trim($splitted[2]) === '?') {
return Node::createOperatorNode($splitted[1], $splitted[0], $parameter); return Node::createOperatorNode($splitted[1], $splitted[0], $parameter);
} else { } else {
return Node::createOperatorNode($splitted[1], $splitted[0], $splitted[2]); return Node::createOperatorNode($splitted[1], $splitted[0], $splitted[2]);

View File

@ -168,7 +168,7 @@ class TreeToSqlParser
if ($this->query->isTimestamp($node->left)) { if ($this->query->isTimestamp($node->left)) {
$node->context = Node::CONTEXT_TIMESTRING; $node->context = Node::CONTEXT_TIMESTRING;
} }
if ($node->context === Node::CONTEXT_TIMESTRING) { if ($node->context === Node::CONTEXT_TIMESTRING && !is_numeric($value)) {
$value = strtotime($value); $value = strtotime($value);
} }
$values[] = $this->query->getDatasource()->getConnection()->quote($value); $values[] = $this->query->getDatasource()->getConnection()->quote($value);