Commit 3a3ed154 authored by Hendrik Heneke's avatar Hendrik Heneke
Browse files

Downgraded to Symfony 4.4.

parent 7939aca5
Pipeline #365 passed with stage
in 26 seconds
...@@ -8,7 +8,7 @@ use Symfony\Component\Dotenv\Dotenv; ...@@ -8,7 +8,7 @@ use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug; use Symfony\Component\ErrorHandler\Debug;
if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) { if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL; echo 'Warning: The console should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
} }
set_time_limit(0); set_time_limit(0);
...@@ -36,26 +36,38 @@ if (null === $projectDir) { ...@@ -36,26 +36,38 @@ if (null === $projectDir) {
require_once $autoloaderPath; require_once $autoloaderPath;
unset($candidates, $autoloaderPathCandidate, $projectDirCandidate); unset($candidates, $autoloaderPathCandidate, $projectDirCandidate);
if (!class_exists(Application::class) || !class_exists(Dotenv::class)) { if (!class_exists(Application::class)) {
throw new LogicException('You need to add "symfony/framework-bundle" and "symfony/dotenv" as Composer dependencies.'); throw new LogicException('You need to add "symfony/framework-bundle" as a Composer dependency.');
} }
$input = new ArgvInput(); $input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) { if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env); putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
} }
if ($input->hasParameterOption('--no-debug', true)) { if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG=' . $_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0'); putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
} }
if (file_exists($projectDir . '/.env')) { if (!class_exists(Dotenv::class)) {
(new Dotenv())->bootEnv($projectDir . '/.env'); throw new LogicException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} }
$debug = false; // Load cached env vars if the .env.local.php file exists
if (isset($_SERVER['APP_DEBUG']) && $_SERVER['APP_DEBUG']) { // Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
$debug = true; if (is_array($env = @include dirname(__DIR__).'/.env.local.php') && (!isset($env['APP_ENV']) || ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? $env['APP_ENV']) === $env['APP_ENV'])) {
(new Dotenv(false))->populate($env);
} else {
// load all the .env files
(new Dotenv(false))->loadEnv(dirname(__DIR__).'/.env');
}
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
if ($_SERVER['APP_DEBUG']) {
umask(0000); umask(0000);
if (class_exists(Debug::class)) { if (class_exists(Debug::class)) {
...@@ -63,6 +75,6 @@ if (isset($_SERVER['APP_DEBUG']) && $_SERVER['APP_DEBUG']) { ...@@ -63,6 +75,6 @@ if (isset($_SERVER['APP_DEBUG']) && $_SERVER['APP_DEBUG']) {
} }
} }
$kernel = new StandaloneKernel($_SERVER['APP_ENV'], $debug); $kernel = new StandaloneKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel); $application = new Application($kernel);
$application->run($input); $application->run($input);
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
"ext-json": "*", "ext-json": "*",
"contao/core-bundle": "4.*", "contao/core-bundle": "4.*",
"paragonie/sodium_compat": "^1.14", "paragonie/sodium_compat": "^1.14",
"symfony/framework-bundle": "4.4.* || 5.2.*", "symfony/framework-bundle": "4.4.*",
"symfony/console": "4.4.* || 5.2.*", "symfony/console": "4.4.*",
"symfony/dotenv": "4.4.* || 5.2.*", "symfony/dotenv": "4.4.*",
"symfony/yaml": "4.4.* || 5.2.*", "symfony/yaml": "4.4.*",
"zordius/lightncandy": "^1.2" "zordius/lightncandy": "^1.2"
}, },
"require-dev": { "require-dev": {
......
This diff is collapsed.
...@@ -39,6 +39,6 @@ class GenerateConfigsCommand extends Command ...@@ -39,6 +39,6 @@ class GenerateConfigsCommand extends Command
$output $output
); );
return $success ? Command::SUCCESS : Command::FAILURE; return $success ? 0 : 1;
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment