X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/6c1977b448e8b195bf96b6144674ffe0527e79de..1cb87164d99701315ac0f2e99beaa6edd64ddb63:/lib/ParameterParser.php diff --git a/lib/ParameterParser.php b/lib/ParameterParser.php index 2eed1629..26b648bb 100644 --- a/lib/ParameterParser.php +++ b/lib/ParameterParser.php @@ -23,7 +23,7 @@ class ParameterParser public function getInt($sName, $bDefault = false) { - if (!isset($this->aParams[$sName]) || strlen($this->aParams[$sName]) == 0) { + if (!isset($this->aParams[$sName])) { return $bDefault; } @@ -36,7 +36,7 @@ class ParameterParser public function getFloat($sName, $bDefault = false) { - if (!isset($this->aParams[$sName]) || strlen($this->aParams[$sName]) == 0) { + if (!isset($this->aParams[$sName])) { return $bDefault; } @@ -74,7 +74,8 @@ class ParameterParser $sValue = $this->getString($sName); if ($sValue) { - return explode(',', $sValue); + // removes all NULL, FALSE and Empty Strings but leaves 0 (zero) values + return array_values(array_filter(explode(',', $sValue), 'strlen')); } return $aDefault; @@ -98,7 +99,7 @@ class ParameterParser arsort($aLanguages); } } - if (!sizeof($aLanguages) && CONST_Default_Language) { + if (empty($aLanguages) && CONST_Default_Language) { $aLanguages[CONST_Default_Language] = 1; }