diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index dba8bd8e..7853e9ed 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -1,8 +1,8 @@ # see https://symfony.com/doc/current/reference/configuration/framework.html framework: secret: '%env(APP_SECRET)%' - csrf_protection: true - #http_method_override: true + #csrf_protection: true + http_method_override: false # Enables session support. Note that the session will ONLY be started if you read or write from it. # Remove or comment this section to explicitly disable session support. @@ -10,8 +10,15 @@ framework: handler_id: null cookie_secure: auto cookie_samesite: lax + storage_factory_id: session.storage.factory.native #esi: true #fragments: true php_errors: log: true + +when@test: + framework: + test: true + session: + storage_factory_id: session.storage.factory.mock_file diff --git a/config/routes/framework.yaml b/config/routes/framework.yaml new file mode 100644 index 00000000..0fc74bba --- /dev/null +++ b/config/routes/framework.yaml @@ -0,0 +1,4 @@ +when@dev: + _errors: + resource: '@FrameworkBundle/Resources/config/routing/errors.xml' + prefix: /_error diff --git a/public/index.php b/public/index.php index f51312c4..9982c218 100644 --- a/public/index.php +++ b/public/index.php @@ -1,37 +1,9 @@ bootEnv(dirname(__DIR__).'/.env'); - -if ($_SERVER['APP_DEBUG']) { - umask(0000); - - Debug::enable(); -} - -if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) { - Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); -} - -if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) { - Request::setTrustedHosts([$trustedHosts]); -} - - -$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']); -$request = Request::createFromGlobals(); - -//Set the proxy settings for heroku -if ($_SERVER['HEROKU'] ?? $_ENV['HEROKU'] ?? false) { - Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')], Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST); -} - -$response = $kernel->handle($request); -$response->send(); -$kernel->terminate($request, $response); +return function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); +}; diff --git a/src/Kernel.php b/src/Kernel.php index 261030ec..c9a55b91 100644 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -20,10 +20,10 @@ class Kernel extends BaseKernel $container->import('../config/parameters.yaml'); if (is_file(\dirname(__DIR__).'/config/services.yaml')) { - $container->import('../config/{services}.yaml'); + $container->import('../config/services.yaml'); $container->import('../config/{services}_'.$this->environment.'.yaml'); - } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) { - (require $path)($container->withPath($path), $this); + } else { + $container->import('../config/{services}.php'); } } @@ -33,9 +33,9 @@ class Kernel extends BaseKernel $routes->import('../config/{routes}/*.yaml'); if (is_file(\dirname(__DIR__).'/config/routes.yaml')) { - $routes->import('../config/{routes}.yaml'); - } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) { - (require $path)($routes->withPath($path), $this); + $routes->import('../config/routes.yaml'); + } else { + $routes->import('../config/{routes}.php'); } } } diff --git a/symfony.lock b/symfony.lock index 0e21a69f..444e4116 100644 --- a/symfony.lock +++ b/symfony.lock @@ -548,7 +548,7 @@ "repo": "github.com/symfony/recipes", "branch": "master", "version": "4.1", - "ref": "f8863cbad2f2e58c4b65fa1eac892ab189971bea" + "ref": "0ce7a032d344fb7b661cd25d31914cd703ad445b" }, "files": [ "./config/packages/dev/debug.yaml" @@ -603,19 +603,18 @@ "version": "v4.2.3" }, "symfony/framework-bundle": { - "version": "5.2", + "version": "5.3", "recipe": { "repo": "github.com/symfony/recipes", "branch": "master", - "version": "5.2", - "ref": "6ec87563dcc85cd0c48856dcfbfc29610506d250" + "version": "5.3", + "ref": "414ba00ad43fa71be42c7906a551f1831716b03c" }, "files": [ "./config/packages/cache.yaml", "./config/packages/framework.yaml", - "./config/packages/test/framework.yaml", "./config/preload.php", - "./config/routes/dev/framework.yaml", + "./config/routes/framework.yaml", "./config/services.yaml", "./public/index.php", "./src/Controller/.gitignore",