Skip to content

Commit

Permalink
bug #33863 [Routing] gracefully handle docref_root ini setting (nicol…
Browse files Browse the repository at this point in the history
…as-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[Routing] gracefully handle docref_root ini setting

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33833
| License       | MIT
| Doc PR        | -

Commits
-------

4d5530f [Routing] gracefully handle docref_root ini setting
  • Loading branch information
nicolas-grekas committed Oct 5, 2019
2 parents 2e92ffe + 4d5530f commit b92d944
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
Expand Up @@ -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');
}
}

0 comments on commit b92d944

Please sign in to comment.