Skip to content

Commit 743be09

Browse files
bug symfony#25523 [WebServerBundle] fix a bug where require would not require the good file because of env (Simperfit)
This PR was merged into the 3.3 branch. Discussion ---------- [WebServerBundle] fix a bug where require would not require the good file because of env | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | symfony#25515 | License | MIT | Doc PR | This fixes a bug with putenv that could be not working on certain version of php. (>=7.0.0). Commits ------- bfeee1f [WebServerBundle] fix a bug where require would not require the good file because of env
2 parents 6935e5a + bfeee1f commit 743be09

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Symfony/Bundle/WebServerBundle/Resources/router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
return false;
3131
}
3232

33-
$script = getenv('APP_FRONT_CONTROLLER') ?: 'index.php';
33+
$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php';
3434

3535
$_SERVER = array_merge($_SERVER, $_ENV);
3636
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script;

src/Symfony/Bundle/WebServerBundle/WebServer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function createServerProcess(WebServerConfig $config)
150150
throw new \RuntimeException('Unable to find the PHP binary.');
151151
}
152152

153-
$process = new Process(array($binary, '-S', $config->getAddress(), $config->getRouter()));
153+
$process = new Process(array($binary, '-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter()));
154154
$process->setWorkingDirectory($config->getDocumentRoot());
155155
$process->setTimeout(null);
156156

src/Symfony/Bundle/WebServerBundle/WebServerConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct($documentRoot, $env, $address = null, $router = null
3232
throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).', $documentRoot, implode(', ', $this->getFrontControllerFileNames($env))));
3333
}
3434

35-
putenv('APP_FRONT_CONTROLLER='.$file);
35+
$_ENV['APP_FRONT_CONTROLLER'] = $file;
3636

3737
$this->documentRoot = $documentRoot;
3838
$this->env = $env;

src/Symfony/Bundle/WebServerBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": "^5.5.9|>=7.0.8",
2020
"symfony/console": "~3.3",
2121
"symfony/http-kernel": "~3.3",
22-
"symfony/process": "~3.3"
22+
"symfony/process": "~3.3.14|^3.4.2"
2323
},
2424
"autoload": {
2525
"psr-4": { "Symfony\\Bundle\\WebServerBundle\\": "" },

0 commit comments

Comments
 (0)