-
Notifications
You must be signed in to change notification settings - Fork 26
Description
What happened?
The current config structure doesn't work well for legacy upgraded Laravel versions.
Related bug: #27
My Laravel project started from 5.6 and is now at v10
I'm following the current config structure:
microsoft-graph' => [
'transport' => 'microsoft-graph',
'client_id' => env('MICROSOFT_GRAPH_CLIENT_ID'),
'client_secret' => env('MICROSOFT_GRAPH_CLIENT_SECRET'),
'tenant_id' => env('MICROSOFT_GRAPH_TENANT_ID'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS'),
'name' => env('MAIL_FROM_NAME'),
],
],
The problem is that dd($config) inside requireConfigString will show below:
protected function requireConfigString(array $config, string $key): string
{
dd($config);
if (! array_key_exists($key, $config)) {
throw new ConfigurationMissing($key);
}
$value = $config[$key];
if (! is_string($value) || $value === '') {
throw new ConfigurationInvalid($key, $value);
}
return $value;
}
result:
So array_key_exists will fail because it only checks the top-level array and not the nested array where microsoft-graph is holding the parameters it needs.
The current solution I found is to not put it inside microsoft-graph and just have it in the config file directly, though the better solution here would be to change the current array_key_exists and create a function to check both top-level and nested array for the value.
current fix:
How to reproduce the bug
Have a Laravel project that has been upgraded since old/legacy version to the current newer version that kept it's old config files intact.
Package Version
1.4
PHP Version
8.1
Laravel Version
10
Which operating systems does with happen with?
No response
Notes
No response