-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebServerBundle] Fix router script option BC #23173
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
Conversation
$this->router = $router ?: __DIR__.'/Resources/router.php'; | ||
$this->router = $router ? realpath($router) : __DIR__.'/Resources/router.php'; | ||
|
||
if (false === $this->router || !file_exists($this->router)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the file existence validation could be skipped when using the built-in one. We already know it exists:
if (null !== $router) {
$absoluteRouterPath = realpath($router);
if (false === $absoluteRouterPath || !file_exists($absoluteRouterPath)) {
throw new \InvalidArgumentException(sprintf('Router script "%s" does not exists.', $router));
}
$this->router = $absoluteRouterPath;
} else {
$this->router = __DIR__.'/Resources/router.php';
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that realpath returns false when the file dont not exist anyway. That'd means the file_exists check is useless, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
e63b990
to
8ba667c
Compare
$absoluteRouterPath = realpath($router); | ||
|
||
if (false === $absoluteRouterPath) { | ||
throw new \InvalidArgumentException(sprintf('Router script "%s" does not exists.', $router)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
8ba667c
to
aeab2fe
Compare
aeab2fe
to
5840c09
Compare
Thank you @1ed. |
This PR was merged into the 3.3 branch. Discussion ---------- [WebServerBundle] Fix router script option BC | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23206 | License | MIT | Doc PR | - Server commands does not work with router script given by a relative path eg.: ``` bin/console server:run -r router.php ``` but, this was working before and was removed (by accident I guess) in https://github.com/symfony/symfony/pull/21039/files#diff-b915f83f99a4166eb34eab581a92501bL187 Commits ------- aeab2fe [WebServerBundle] Fix router script path and check existence
Server commands does not work with router script given by a relative path eg.:
but, this was working before and was removed (by accident I guess) in https://github.com/symfony/symfony/pull/21039/files#diff-b915f83f99a4166eb34eab581a92501bL187