Skip to content

Commit 7ff3ec3

Browse files
committed
Bump doctrine/orm to 3.6.2 for consistent dsn parsing
1 parent 0cd4c03 commit 7ff3ec3

3 files changed

Lines changed: 220 additions & 441 deletions

File tree

DbalConnectionFactory.php

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -147,33 +147,22 @@ private function parseDsn(string $dsn, ?array $config = null): array
147147
];
148148
}
149149

150-
if (class_exists(DsnParser::class)) { // DBAL >= 4
151-
if ($dsnHasProtocolOnly) {
152-
$dsn = $parsedDsn->getScheme().'://root@localhost';
153-
}
154-
155-
$dsnParser = new DsnParser($supported);
156-
157-
// replace scheme with the matching one from the supported list, but the prefixes there are "pdo-" not "pdo_"
158-
$dsn = preg_replace(
159-
'/^'.preg_quote($parsedDsn->getScheme(), '/').'(:|:\/\/)/',
160-
str_replace('_', '-', $supported[$parsedDsn->getScheme()]).'$1',
161-
$dsn,
162-
);
163-
164-
return [
165-
'lazy' => true,
166-
'connection' => $dsnParser->parse($dsn),
167-
];
150+
if ($dsnHasProtocolOnly) {
151+
$dsn = $parsedDsn->getScheme().'://root@localhost';
168152
}
169153

170-
$dsn = $dsnHasProtocolOnly ?
171-
$doctrineScheme.'://root@localhost' :
172-
str_replace($parsedDsn->getScheme(), $doctrineScheme, $dsn);
154+
$dsnParser = new DsnParser($supported);
155+
156+
// replace scheme with the matching one from the supported list, but the prefixes there are "pdo-" not "pdo_"
157+
$dsn = preg_replace(
158+
'/^'.preg_quote($parsedDsn->getScheme(), '/').'(:|:\/\/)/',
159+
str_replace('_', '-', $supported[$parsedDsn->getScheme()]).'$1',
160+
$dsn,
161+
);
173162

174163
return [
175164
'lazy' => true,
176-
'connection' => ['url' => $dsn],
165+
'connection' => $dsnParser->parse($dsn),
177166
];
178167
}
179168
}

0 commit comments

Comments
 (0)