Menu/Voter/UriVoter.php
public function matchItem(ItemInterface $item)
    {
        if (null === $this->request) {
            return null;
        }

        $uri = $item->getUri();
        if (0 < strlen($scriptName = $this->request->getScriptName())) {
            if (0 === strpos($uri, $this->request->getScriptName())) {
                $uri = substr($uri, strlen($this->request->getScriptName()));
            }
        }

        if (1 >= strlen($uri)) {
            return null;
        }

        if (preg_match(sprintf('#^%s#', $uri), $this->request->getPathInfo())) {
            return true;
        }

        return null;
    }
public function matchItem(ItemInterface $item)
    {
        if (null === $this->request) {
            return null;
        }

        $uri = $item->getUri();
        if (0 < strlen($scriptName = $this->request->getScriptName())) {
            if (0 === strpos($uri, $this->request->getScriptName())) {
                $uri = substr($uri, strlen($this->request->getScriptName()));
            }
        }

        if (1 >= strlen($uri)) {
            return null;
        }

        if (preg_match(sprintf('#^%s#', $uri), $this->request->getPathInfo())) {
            return true;
        }

        return null;
    }
{@inheritdoc}