laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 419 forks source link

PHP7.4 support for ServiceProvider #1008

Closed rolandsusans closed 4 years ago

rolandsusans commented 4 years ago

Description:

When I try to run integration tests without a specific config for view

base Illuminate\Support\ServiceProvider fails @ line 97 ~ https://github.com/illuminate/support/blob/master/ServiceProvider.php#L94


ErrorException: Trying to access array offset on value of type null

/path/to/project/vendor/illuminate/support/ServiceProvider.php:97
/path/to/project/vendor/illuminate/pagination/PaginationServiceProvider.php:16
/path/to/project/vendor/illuminate/container/BoundMethod.php:32
/path/to/project/vendor/illuminate/container/BoundMethod.php:90
/path/to/project/vendor/illuminate/container/BoundMethod.php:34
/path/to/project/vendor/illuminate/container/Container.php:576
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:244
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:204
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:615
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:371
/path/to/project/vendor/illuminate/container/Container.php:785
/path/to/project/vendor/illuminate/container/Container.php:667
/path/to/project/vendor/illuminate/container/Container.php:615
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:267
/path/to/project/vendor/illuminate/container/Container.php:1227
/path/to/project/vendor/illuminate/database/MigrationServiceProvider.php:37
/path/to/project/vendor/illuminate/container/Container.php:785
/path/to/project/vendor/illuminate/container/Container.php:667
/path/to/project/vendor/illuminate/container/Container.php:615
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:267
/path/to/project/vendor/illuminate/container/Container.php:1227
/path/to/project/vendor/illuminate/database/MigrationServiceProvider.php:52
/path/to/project/vendor/illuminate/container/Container.php:785
/path/to/project/vendor/illuminate/container/Container.php:667
/path/to/project/vendor/illuminate/container/Container.php:615
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:267
/path/to/project/vendor/illuminate/container/Container.php:1227
/path/to/project/vendor/laravel/lumen-framework/src/Console/ConsoleServiceProvider.php:156
/path/to/project/vendor/illuminate/container/Container.php:785
/path/to/project/vendor/illuminate/container/Container.php:667
/path/to/project/vendor/illuminate/container/Container.php:615
/path/to/project/vendor/laravel/lumen-framework/src/Application.php:267
/path/to/project/vendor/illuminate/console/Application.php:258
/path/to/project/vendor/illuminate/console/Application.php:272
/path/to/project/vendor/illuminate/support/ServiceProvider.php:280
/path/to/project/vendor/illuminate/console/Application.php:149
/path/to/project/vendor/illuminate/console/Application.php:72
/path/to/project/vendor/laravel/lumen-framework/src/Console/Kernel.php:208
/path/to/project/vendor/laravel/lumen-framework/src/Console/Kernel.php:165
/path/to/project/vendor/laravel/lumen-framework/src/Testing/TestCase.php:315
/path/to/project/vendor/kasko/testing-lib/src/Integration/EventMockTrait.php:28
/path/to/project/tests/Integration/Listeners/MyTest:22

meanwhile PHP7.3 works without exception.

Steps To Reproduce:

Initiate app using PHP7.4

rolandsusans commented 4 years ago

Without changes, this line is producing a notice in cases when config is not specified.

if (is_array($this->app->config['view']['paths'])) {
 ...
}

e.g. @ see https://3v4l.org/YLXf7 The proper way to avoid receiving notice here is to check value with isset before accessing it.

if (isset($this->app->config['view']['paths']) && is_array($this->app->config['view']['paths'])) {
...
}
driesvints commented 4 years ago

5.8 isn't supported anymore but since this is also present on 6.x I'll leave this open.

driesvints commented 4 years ago

This was fixed on 6.x recently