44use App \Kernel ;
55use Symfony \Bundle \FrameworkBundle \Console \Application ;
66use Symfony \Component \Console \Input \ArgvInput ;
7- use Symfony \Component \Debug \Debug ;
7+ use Symfony \Component \ErrorHandler \Debug ;
8+
9+ if (false === in_array (\PHP_SAPI , ['cli ' , 'phpdbg ' , 'embed ' ], true )) {
10+ echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' .\PHP_SAPI .' SAPI ' .\PHP_EOL ;
11+ }
812
913set_time_limit (0 );
1014
@@ -15,17 +19,15 @@ if (!class_exists(Application::class)) {
1519}
1620
1721$ input = new ArgvInput ();
18- if (null !== $ _ENV ['APP_ENV ' ] = $ input ->getParameterOption (['--env ' , '-e ' ], null , true )) {
19- putenv ('APP_ENV= ' .$ _ENV ['APP_ENV ' ]);
20- // force loading .env files when --env is defined
21- $ _SERVER ['APP_ENV ' ] = null ;
22+ if (null !== $ env = $ input ->getParameterOption (['--env ' , '-e ' ], null , true )) {
23+ putenv ('APP_ENV= ' .$ _SERVER ['APP_ENV ' ] = $ _ENV ['APP_ENV ' ] = $ env );
2224}
2325
2426if ($ input ->hasParameterOption ('--no-debug ' , true )) {
2527 putenv ('APP_DEBUG= ' .$ _SERVER ['APP_DEBUG ' ] = $ _ENV ['APP_DEBUG ' ] = '0 ' );
2628}
2729
28- require dirname (__DIR__ ).'/src/. bootstrap.php ' ;
30+ require dirname (__DIR__ ).'/config/ bootstrap.php ' ;
2931
3032if ($ _SERVER ['APP_DEBUG ' ]) {
3133 umask (0000 );
@@ -35,6 +37,6 @@ if ($_SERVER['APP_DEBUG']) {
3537 }
3638}
3739
38- $ kernel = new Kernel ($ _SERVER ['APP_ENV ' ], $ _SERVER ['APP_DEBUG ' ]);
40+ $ kernel = new Kernel ($ _SERVER ['APP_ENV ' ], ( bool ) $ _SERVER ['APP_DEBUG ' ]);
3941$ application = new Application ($ kernel );
4042$ application ->run ($ input );
0 commit comments