Skip to content

Commit 1badc12

Browse files
authored
Fix type casting for environment variables in config files (#55737)
Explicitly cast environment variables to strings to ensure consistent behaviour across all configuration files. This prevents potential type-related issues when parsing or evaluating environment variables.
1 parent f43f238 commit 1badc12

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

config/app.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130

131131
'previous_keys' => [
132132
...array_filter(
133-
explode(',', env('APP_PREVIOUS_KEYS', ''))
133+
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
134134
),
135135
],
136136

config/cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@
103103
|
104104
*/
105105

106-
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
106+
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel'), '_').'_cache_'),
107107

108108
];

config/database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148

149149
'options' => [
150150
'cluster' => env('REDIS_CLUSTER', 'redis'),
151-
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
151+
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel'), '_').'_database_'),
152152
'persistent' => env('REDIS_PERSISTENT', false),
153153
],
154154

config/logging.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
'stack' => [
5656
'driver' => 'stack',
57-
'channels' => explode(',', env('LOG_STACK', 'single')),
57+
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
5858
'ignore_exceptions' => false,
5959
],
6060

config/mail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
'username' => env('MAIL_USERNAME'),
4747
'password' => env('MAIL_PASSWORD'),
4848
'timeout' => null,
49-
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
49+
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
5050
],
5151

5252
'ses' => [

config/session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129

130130
'cookie' => env(
131131
'SESSION_COOKIE',
132-
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
132+
Str::slug((string) env('APP_NAME', 'laravel'), '_').'_session'
133133
),
134134

135135
/*

0 commit comments

Comments
 (0)