Replies: 6 comments
-
You have to URL encode the password, or any other value that contains an unsupported character.
|
Beta Was this translation helpful? Give feedback.
-
@rojtjo I think ideally it should work out of the box? |
Beta Was this translation helpful? Give feedback.
-
I don't think there's a safe way to automatically encode a value like this: It already correctly encodes the values when using the separate environment vars |
Beta Was this translation helpful? Give feedback.
-
I think we can use regex for that as we know the format is
Will back to you with the formula. Sample regex
const we can't use |
Beta Was this translation helpful? Give feedback.
-
FYI, I tried the URL with URL encoded password. |
Beta Was this translation helpful? Give feedback.
-
Updates: I tried the same DSN using Doctrine and it's working fine in Doctrine. |
Beta Was this translation helpful? Give feedback.
-
Laravel Version
11.24.1
PHP Version
8.1.28
Database Driver & Version
MySQL 8.0.37
Description
Laravel config parse URL is using php
parse_url()
which will fail the database URL password have#
characters.For example below config
The config above will throw exception message
because the source code https://github.com/laravel/framework/blob/296f3f8b391782deacc873272e0c09550fb02c10/src/Illuminate/Support/ConfigurationUrlParser.php#L132C5-L143C6 is using function
parse_url()
to parse the config above and it will returnfalse
if the url contain#
Tested with Laravel v9. But I believe the same issue will happen in Laravel v11 as the source code still the same as in link above.
Steps To Reproduce
Create a database config as shown above and try to query database, we will get exception
Beta Was this translation helpful? Give feedback.
All reactions