From 9effb0d5e951dfcee07ceab6dff98e85a9ba7a0c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 16 Jun 2020 11:38:25 +0200 Subject: [PATCH] check for PHP files to exist before requiring them --- symfony/framework-bundle/5.1/src/Kernel.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/symfony/framework-bundle/5.1/src/Kernel.php b/symfony/framework-bundle/5.1/src/Kernel.php index 3f282188..b0168617 100644 --- a/symfony/framework-bundle/5.1/src/Kernel.php +++ b/symfony/framework-bundle/5.1/src/Kernel.php @@ -16,11 +16,10 @@ class Kernel extends BaseKernel $container->import('../config/{packages}/*.yaml'); $container->import('../config/{packages}/'.$this->environment.'/*.yaml'); - if (file_exists(\dirname(__DIR__).'/config/services.yaml')) { + if (is_file(\dirname(__DIR__).'/config/services.yaml')) { $container->import('../config/{services}.yaml'); $container->import('../config/{services}_'.$this->environment.'.yaml'); - } else { - $path = \dirname(__DIR__).'/config/services.php'; + } elseif (is_file($path = \dirname(__DIR__).'/config/services.php')) { (require $path)($container->withPath($path), $this); } } @@ -30,10 +29,9 @@ class Kernel extends BaseKernel $routes->import('../config/{routes}/'.$this->environment.'/*.yaml'); $routes->import('../config/{routes}/*.yaml'); - if (file_exists(\dirname(__DIR__).'/config/routes.yaml')) { + if (is_file(\dirname(__DIR__).'/config/routes.yaml')) { $routes->import('../config/{routes}.yaml'); - } else { - $path = \dirname(__DIR__).'/config/routes.php'; + } elseif (is_file($path = \dirname(__DIR__).'/config/routes.php')) { (require $path)($routes->withPath($path), $this); } }