From 4d5530f8a4a5ccd480bac3c33d0c9f2f201e64c8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 4 Oct 2019 22:55:59 +0200 Subject: [PATCH] [Routing] gracefully handle docref_root ini setting --- .../Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php | 4 ++-- .../Routing/Matcher/Dumper/StaticPrefixCollection.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php index 51cb046b3341..ab67e6885ac9 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php @@ -91,7 +91,7 @@ public function getCompiledRoutes(bool $forDump = false): array while (true) { try { - $this->signalingException = new \RuntimeException('preg_match(): Compilation failed: regular expression is too large'); + $this->signalingException = new \RuntimeException('Compilation failed: regular expression is too large'); $compiledRoutes = array_merge($compiledRoutes, $this->compileDynamicRoutes($dynamicRoutes, $matchHost, $chunkLimit, $conditions)); break; @@ -349,7 +349,7 @@ private function compileDynamicRoutes(RouteCollection $collection, bool $matchHo $state->markTail = 0; // if the regex is too large, throw a signaling exception to recompute with smaller chunk size - set_error_handler(function ($type, $message) { throw 0 === strpos($message, $this->signalingException->getMessage()) ? $this->signalingException : new \ErrorException($message); }); + set_error_handler(function ($type, $message) { throw false !== strpos($message, $this->signalingException->getMessage()) ? $this->signalingException : new \ErrorException($message); }); try { preg_match($state->regex, ''); } finally { diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php b/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php index 50f974f2e812..65b6c0718b31 100644 --- a/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php +++ b/src/Symfony/Component/Routing/Matcher/Dumper/StaticPrefixCollection.php @@ -197,6 +197,6 @@ private function getCommonPrefix(string $prefix, string $anotherPrefix): array public static function handleError($type, $msg) { - return 0 === strpos($msg, 'preg_match(): Compilation failed: lookbehind assertion is not fixed length'); + return false !== strpos($msg, 'Compilation failed: lookbehind assertion is not fixed length'); } }