bug #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 | #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
This commit is contained in:
Nicolas Grekas 2017-12-20 15:28:41 +01:00
commit 743be09e3d
4 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'
return false;
}
$script = getenv('APP_FRONT_CONTROLLER') ?: 'index.php';
$script = isset($_ENV['APP_FRONT_CONTROLLER']) ? $_ENV['APP_FRONT_CONTROLLER'] : 'index.php';
$_SERVER = array_merge($_SERVER, $_ENV);
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$script;

View File

@ -150,7 +150,7 @@ class WebServer
throw new \RuntimeException('Unable to find the PHP binary.');
}
$process = new Process(array($binary, '-S', $config->getAddress(), $config->getRouter()));
$process = new Process(array($binary, '-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter()));
$process->setWorkingDirectory($config->getDocumentRoot());
$process->setTimeout(null);

View File

@ -32,7 +32,7 @@ class WebServerConfig
throw new \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).', $documentRoot, implode(', ', $this->getFrontControllerFileNames($env))));
}
putenv('APP_FRONT_CONTROLLER='.$file);
$_ENV['APP_FRONT_CONTROLLER'] = $file;
$this->documentRoot = $documentRoot;
$this->env = $env;

View File

@ -19,7 +19,7 @@
"php": "^5.5.9|>=7.0.8",
"symfony/console": "~3.3",
"symfony/http-kernel": "~3.3",
"symfony/process": "~3.3"
"symfony/process": "~3.3.14|^3.4.2"
},
"autoload": {
"psr-4": { "Symfony\\Bundle\\WebServerBundle\\": "" },