Skip to content

Commit 712afd2

Browse files
committed
URL encode variables that go into a MySQL credentials URI
See for reference: - https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri - https://symfony.com/doc/current/doctrine.html but note that we must use `rawurlencode` instead of `urlencode` which differ in how they encode a space (as tested). Fixes: #2651 Closes: #2502 as this is likely fixed but I couldn't reproduce it
1 parent a66de79 commit 712afd2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

webapp/config/load_db_secrets.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ function get_db_url(): string
3636
break;
3737
}
3838

39-
return sprintf('mysql://%s:%s@%s:%d/%s?serverVersion=5.7.0', $user, $pass, $host, $port ?? 3306, $db);
39+
return sprintf(
40+
'mysql://%s:%s@%s:%d/%s?serverVersion=5.7.0',
41+
rawurlencode($user), rawurlencode($pass), rawurlencode($host),
42+
$port ?? 3306, rawurlencode($db)
43+
);
4044
}
4145

4246
function get_app_secret(): string

webapp/config/packages/doctrine.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ doctrine:
77
charset: utf8mb4
88
collate: utf8mb4_unicode_ci
99

10-
url: '%env(resolve:DATABASE_URL)%'
10+
url: '%env(DATABASE_URL)%'
1111
profiling_collect_backtrace: '%kernel.debug%'
1212
types:
1313
tinyint: App\Doctrine\DBAL\Types\TinyIntType

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy