Using a numeric value as a key for a database connection in config file will result in it not being loaded with that name. #52956
Unanswered
ItsClassified
asked this question in
Ideas
Replies: 2 comments 12 replies
-
Just to add a bit more, the issue is when it tries to merge |
Beta Was this translation helpful? Give feedback.
0 replies
-
I don't think we have considered using an integer key as a valid configuration key. Moving this into Ideas for now and feel free to discuss this further. |
Beta Was this translation helpful? Give feedback.
12 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Laravel Version
11.23.5
PHP Version
8.3.11
Database Driver & Version
MySQL
Description
When using numeric values in the database.php config file Laravel will disregard the names and load them starting from 0, and increasing for each connection after that with a numeric value as name.
@ollieread found that commenting out row 127 in the following file makes it load in again: https://github.com/laravel/framework/blob/11.x/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php#L103
The issue appears to be on L103 using
array_merge
Steps To Reproduce
Change a connection name to a numeric string, for example: '12345' and try to access it using DB::connection.
Beta Was this translation helpful? Give feedback.
All reactions