public function validateFilter($filter)
    {
        // Match a regex pattern instead of just exploding on '-' (this fail with negative numbers).
        $regexp = "/(-?[0-9]+)-(-?[0-9]+)/";
        preg_match_all($regexp, $filter, $matches);

        // Whole match + two groups matches.
        if (count($matches) !== 3) {
            return false;
        }

        $filter = [current($matches[1]), current($matches[2])];

        // Legacy check for >=0 is also removed here.
        foreach ($filter as $v) {
            if (is_infinite((double) $v)) {
                return false;
            }
        }

        return $filter;
    }
public function validateFilter($filter)
    {
        // Match a regex pattern instead of just exploding on '-' (this fail with negative numbers).
        $regexp = "/(-?[0-9]+)-(-?[0-9]+)/";
        preg_match_all($regexp, $filter, $matches);

        // Whole match + two groups matches.
        if (count($matches) !== 3) {
            return false;
        }

        $filter = [current($matches[1]), current($matches[2])];

        // Legacy check for >=0 is also removed here.
        foreach ($filter as $v) {
            if (is_infinite((double) $v)) {
                return false;
            }
        }

        return $filter;
    }
public function validateFilter ( $ filter ) { // Match a regex pattern instead of just exploding on '-' (this fail with negative numbers). $ regexp = "/(-?[0-9]+)-(-?[0-9]+)/" ; preg_match_all ( $ regexp , $ filter , $ matches ) ; // Whole match + two groups matches. if ( count ( $ matches ) !== 3 ) { return false ; } $ filter = [ current ( $ matches [ 1 ] ) , current ( $ matches [ 2 ] ) ] ; // Legacy check for >=0 is also removed here. foreach ( $ filter as $ v ) { if ( is_infinite ( ( double ) $ v ) ) { return false ; } } return $ filter ; }
Validate and parse filter request param.

Use this one instead of the legacy to ensure negative values are properly computed.

@param string $filter The raw filter value (XXX-XXX)

@return array|bool
Validate and parse filter request param .