From ecbdb07bea2bd2e277111aca209cbcd21ad93c3c Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Fri, 20 Jun 2014 13:06:07 +0200 Subject: [PATCH] FilterQueryString: fix handling encoded <> signs Those signs are URL-encoded and therefore not "seen" before decoding the "key" part when the sit in front of the = sign. Same goes for standalone ones. Fixed. --- library/Icinga/Data/Filter/FilterQueryString.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Data/Filter/FilterQueryString.php b/library/Icinga/Data/Filter/FilterQueryString.php index 41ef15329..2ad3d4d2c 100644 --- a/library/Icinga/Data/Filter/FilterQueryString.php +++ b/library/Icinga/Data/Filter/FilterQueryString.php @@ -46,12 +46,23 @@ class FilterQueryString protected function readNextExpression() { - if ('' === ($key = $this->readNextKey())) { return false; } - $sign = $this->readChar(); + foreach (array('<', '>') as $sign) { + if (false !== ($pos = strpos($key, $sign))) { + if ($this->nextChar() === '=') break; + $var = substr($key, $pos + 1); + $key = substr($key, 0, $pos); + return Filter::expression($key, $sign, $var); + } + } + if (in_array($this->nextChar(), array('=', '>', '<', '!'))) { + $sign = $this->readChar(); + } else { + $sign = false; + } if ($sign === false) { return Filter::expression($key, '=', true); }