laravel-debugbar
laravel-debugbar copied to clipboard
PHP8.2 explode(): Passing null to parameter #2 ($string) of type string is deprecated
Hi.
- deprecated by PHP8.2
-
local.WARNING: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /*/vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php
-
- use PHP-CS-Fixer (LaravelPint) to config/debugbar.php
Can confirm the issue, even with an identical config file as in the repo.
// returns `null`
$this->app['config']->get('debugbar.remote_sites_path')
// returns `null`
$this->app['config']->get('debugbar.remote_sites_path', '')
// returns null 🤷♂️
$this->app['config']->get('debugbar.remote_sites_path', 'uhmmm')
It should fall back to the second parameter, but for some reason it doesn't and you get the deprecation warning in the log.
env() function returns the value if the key exists.
// config/debugbar.php
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH')
// remote_sites_path is null
// src/LaravelDebugbar.php
$foo = $this->app['config']->get('debugbar.remote_sites_path', '');
// $foo is null
$bar = $this->app['config']->get('debugbar.remote_sites_path') ?? '';
// $bar is empty string
// config/debugbar.php
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH', '')
// remote_sites_path is empty string
// src/LaravelDebugbar.php
$foo = $this->app['config']->get('debugbar.remote_sites_path', '');
// $foo is empty string
$bar = $this->app['config']->get('debugbar.remote_sites_path') ?? '';
// $bar is empty string
// config/debugbar.php
// 'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH') comment out
// src/LaravelDebugbar.php
$foo = $this->app['config']->get('debugbar.remote_sites_path', '');
// $foo is empty string
$bar = $this->app['config']->get('debugbar.remote_sites_path') ?? '';
// $bar is empty string