Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP-Setting:docref_root breaks getCompiledRoutes #33833

Closed
pesc opened this issue Oct 3, 2019 · 0 comments
Closed

PHP-Setting:docref_root breaks getCompiledRoutes #33833

pesc opened this issue Oct 3, 2019 · 0 comments

Comments

@pesc
Copy link

pesc commented Oct 3, 2019

Symfony version(s) affected: 4.3, 4.4

Description
When the PHP docref_root is set, comparsion (===) doesn't match anymore:

if (1 < $chunkLimit && $this->signalingException === $e) {

The docref_root set's an URL to a manual and prints it out for exceptions, like this -> in my example to https://secure.php.net/manual/en/:

preg_match() [<a href='https://secure.php.net/manual/en/function.preg-match.php'>function.preg-match.php</a>]: Compilation failed: regular expression is too large at offset 61332

Main problem is that the strpos doesn't return any results:

set_error_handler(function ($type, $message) { throw 0 === strpos($message, $this->signalingException->getMessage()) ? $this->signalingException : new \ErrorException($message); });

<?php
$mystring = "preg_match() [<a href='https://secure.php.net/manual/en/function.preg-match.php'>function.preg-match.php</a>]: Compilation failed: regular expression is too large at offset 61332";
$findme   = 'preg_match(): Compilation failed: regular expression is too large';
$pos = strpos($mystring, $findme);

// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
    echo "The string '$findme' was not found in the string '$mystring'";
} else {
    echo "The string '$findme' was found in the string '$mystring'";
    echo " and exists at position $pos";
}
?>

The string 'preg_match(): Compilation failed: regular expression is too large' was not found in the string 'preg_match() [<a href='https://secure.php.net/manual/en/function.preg-match.php'>function.preg-match.php</a>]: Compilation failed: regular expression is too large at offset 61332'

How to reproduce
set docref_root to https://secure.php.net/manual/en/ in your php.ini/user.ini....

Possible Solution
unset docref_root to https://secure.php.net/manual/en/ in your php.ini/user.ini....

nicolas-grekas added a commit that referenced this issue Oct 5, 2019
…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
@fabpot fabpot closed this as completed Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants