Skip to content
Permalink
Browse files

URL-decode URL-style DSN

  • Loading branch information
c960657 authored and Christian Schmidt committed Sep 12, 2016
1 parent 7963f13 commit 2dc419625299be3b91ced60ca4658fb95abb3722
Showing with 6 additions and 0 deletions.
  1. +2 −0 lib/Doctrine/DBAL/DriverManager.php
  2. +4 −0 tests/Doctrine/Tests/DBAL/DriverManagerTest.php
@@ -259,6 +259,8 @@ private static function parseDatabaseUrl(array $params)
throw new DBALException('Malformed parameter "url".');
}
$url = array_map('rawurldecode', $url);
// If we have a connection URL, we have to unset the default PDO instance connection parameter (if any)
// as we cannot merge connection details from the URL into the PDO instance (URL takes precedence).
unset($params['pdo']);
@@ -199,6 +199,10 @@ public function databaseUrls()
'drizzle-pdo-mysql://foo:bar@localhost/baz',
array('user' => 'foo', 'password' => 'bar', 'host' => 'localhost', 'dbname' => 'baz', 'driver' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver'),
),
'simple URL with percent encoding' => array(
'mysql://foo%3A:bar%2F@localhost/baz+baz%40',
array('user' => 'foo:', 'password' => 'bar/', 'host' => 'localhost', 'dbname' => 'baz+baz@', 'driver' => 'Doctrine\DBAL\Driver\PDOMySQL\Driver'),
),
// DBAL-1234
'URL without scheme and without any driver information' => array(

0 comments on commit 2dc4196

Please sign in to comment.
You can’t perform that action at this time.