Commit 1941f068 authored by Steve Müller's avatar Steve Müller Committed by Marco Pivetta

fix parsing schemeless connection URLs with PHP < 5.4.8

parent 0f13e3b1
......@@ -244,7 +244,15 @@ final class DriverManager
// (pdo_)?sqlite3?:///... => (pdo_)?sqlite3?://localhost/... or else the URL will be invalid
$url = preg_replace('#^((?:pdo_)?sqlite3?):///#', '$1://localhost/', $params['url']);
$url = parse_url($url);
// PHP < 5.4.8 doesn't parse schemeless urls properly.
// See: https://php.net/parse-url#refsect1-function.parse-url-changelog
if (PHP_VERSION_ID < 50408 && strpos($url, '//') === 0) {
$url = parse_url('fake:' . $url);
unset($url['scheme']);
} else {
$url = parse_url($url);
}
if ($url === false) {
throw new DBALException('Malformed parameter "url".');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment