Skip to content

Commit

Permalink
Fix that the queryfilter parser cannot handle integer values
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Meyer committed Apr 1, 2014
1 parent b22f3f6 commit 862b502
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion library/Icinga/Data/BaseQuery.php
Expand Up @@ -472,7 +472,7 @@ protected function parseFilterExpression($expression, $parameter = null)
Node::createOperatorNode($splitted[0], $splitted[1], is_string($parameter));
return Node::createOperatorNode(Node::OPERATOR_EQUALS, $splitted[0], $parameter);
} elseif (count($splitted) === 3) {
if (trim($splitted[2]) === '?' && is_string($parameter)) {
if (trim($splitted[2]) === '?') {
return Node::createOperatorNode($splitted[1], $splitted[0], $parameter);
} else {
return Node::createOperatorNode($splitted[1], $splitted[0], $splitted[2]);
Expand Down
2 changes: 1 addition & 1 deletion library/Icinga/Data/Db/TreeToSqlParser.php
Expand Up @@ -168,7 +168,7 @@ private function addValueToQuery(Node $node, $query) {
if ($this->query->isTimestamp($node->left)) {
$node->context = Node::CONTEXT_TIMESTRING;
}
if ($node->context === Node::CONTEXT_TIMESTRING) {
if ($node->context === Node::CONTEXT_TIMESTRING && !is_numeric($value)) {
$value = strtotime($value);
}
$values[] = $this->query->getDatasource()->getConnection()->quote($value);
Expand Down

0 comments on commit 862b502

Please sign in to comment.