I followed all the upgrade guide requirements, but when I run php artisan, I get the following error:
Undefined array key "driver"
at vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php:117
113▕ * @return bool
114▕ */
115▕ protected function shouldServeFiles(array $config)
116▕ {
➜ 117▕ return $config['driver'] === 'local' && ($config['serve'] ?? false);
118▕ }
119▕
120▕ /**
121▕ * Get the default file driver.
I checked the vendor files and found the function responsible:
/**
* Determine if the disk is serveable.
*
* @param array $config
* @return bool
*/
protected function shouldServeFiles(array $config)
{
return $config['driver'] === 'local' && ($config['serve'] ?? false);
}
To debug, I dumped the $config and got:
array:3 [
"driver" => "local"
"root" => "/var/www/html/storage/app"
"throw" => false
]
When I dd() the full condition, it returns false:
dd($config['driver'] === 'local' && ($config['serve'] ?? false));
If I modify the vendor file to return false, php artisan starts working again—but obviously, modifying vendor files isn’t a proper solution.
My filestems.php file
's3' => [
'blog' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'blog',
'url' => env('AWS_URL').'/blog',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'verifications' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'verifications',
'url' => env('AWS_URL').'/verifications',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'contracts' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'contracts',
'url' => env('AWS_URL').'/contracts',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'preliminary' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'preliminary',
'url' => env('AWS_URL').'/preliminary',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'temporary' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'temporary',
'url' => env('AWS_URL').'/temporary',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'internal' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'internal',
'url' => env('AWS_URL').'/internal',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'listing-images' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'listing-images',
'url' => env('AWS_URL').'/listing-images',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'payout-invoices' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'payout-invoices',
'url' => env('AWS_URL').'/payout-invoices',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
'listing-payment-invoices' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => 'listing-payment-invoices',
'url' => env('AWS_URL').'/listing-payment-invoices',
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', true),
'throw' => true,
],
],
Has anyone encountered this issue before? Any insights on how to fix it properly?