Skip to content

Commit 8ba667c

Browse files
committed
[WebServerBundle] Fix router script path and check existence
1 parent 1a3d42f commit 8ba667c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Symfony/Bundle/WebServerBundle/WebServerConfig.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,18 @@ public function __construct($documentRoot, $env, $address = null, $router = null
3636

3737
$this->documentRoot = $documentRoot;
3838
$this->env = $env;
39-
$this->router = $router ?: __DIR__.'/Resources/router.php';
39+
40+
if (null !== $router) {
41+
$absoluteRouterPath = realpath($router);
42+
43+
if (false === $absoluteRouterPath) {
44+
throw new \InvalidArgumentException(sprintf('Router script "%s" does not exists.', $router));
45+
}
46+
47+
$this->router = $absoluteRouterPath;
48+
} else {
49+
$this->router = __DIR__.'/Resources/router.php';
50+
}
4051

4152
if (null === $address) {
4253
$this->hostname = '127.0.0.1';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy