From 0a16cf21021bc85cccd743da84897d3abcbabfbe Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 3 Sep 2014 22:34:28 +0200 Subject: [PATCH] improve handling router script paths The `server:run` command switches the working directory before starting the built-in web server. Therefore, the path to a custom router script had to be specified based on the document root path and not based on the user's working directory. --- .../Bundle/FrameworkBundle/Command/ServerRunCommand.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php index 3535167910..0e6972046d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php @@ -101,6 +101,14 @@ EOF ->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env)) ; + if (!file_exists($router)) { + $output->writeln(sprintf('The given router script "%s" does not exist', $router)); + + return 1; + } + + $router = realpath($router); + $output->writeln(sprintf("Server running on http://%s\n", $input->getArgument('address'))); $builder = new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));