Skip to content

Commit 30bde89

Browse files
committed
bug symfony#12525 [Bundle][FrameworkBundle] be smarter when guessing the document root (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- [Bundle][FrameworkBundle] be smarter when guessing the document root | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#12524 | License | MIT | Doc PR | Commits ------- e28f5b8 be smarter when guessing the document root
2 parents 226b0ce + e28f5b8 commit 30bde89

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function configure()
4444
$this
4545
->setDefinition(array(
4646
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', 'localhost:8000'),
47-
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', 'web/'),
47+
new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null),
4848
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
4949
))
5050
->setName('server:run')
@@ -83,6 +83,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
8383
{
8484
$documentRoot = $input->getOption('docroot');
8585

86+
if (null === $documentRoot) {
87+
$documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web';
88+
}
89+
8690
if (!is_dir($documentRoot)) {
8791
$output->writeln(sprintf('<error>The given document root directory "%s" does not exist</error>', $documentRoot));
8892

0 commit comments

Comments
 (0)