-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Labels
Description
- Laravel Version: 8.67.0
- PHP Version: 8.0.11
Description:
Resolving env service before binding if class not found in configuration files.
Steps To Reproduce:
In one config file (Eg. config/logging.php
), using a class, that isn't existed.
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', ClassNotExisted::CONST_A),
Run: php artisan
Expected
Throw class ClassNotExisted
not found exception
Actual
Throw ReflectionException and BindingResolutionException
Uncaught ReflectionException: Class "env" does not exist in project/vendor/laravel/framework/src/Illuminate/Container/Container.php:877
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [env] does not exist. in project/vendor/laravel/framework/src/Illuminate/Container/Container.php:879
Reason
Try resolving env
service before binding
https://github.com/laravel/framework/blob/8.x/src/Illuminate/Log/LogManager.php#L523..L525