Commit 2dc41962 authored by Christian Schmidt's avatar Christian Schmidt Committed by Christian Schmidt

URL-decode URL-style DSN

parent 7963f131
...@@ -259,6 +259,8 @@ final class DriverManager ...@@ -259,6 +259,8 @@ final class DriverManager
throw new DBALException('Malformed parameter "url".'); 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) // 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). // as we cannot merge connection details from the URL into the PDO instance (URL takes precedence).
unset($params['pdo']); unset($params['pdo']);
......
...@@ -199,6 +199,10 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase ...@@ -199,6 +199,10 @@ class DriverManagerTest extends \Doctrine\Tests\DbalTestCase
'drizzle-pdo-mysql://foo:bar@localhost/baz', 'drizzle-pdo-mysql://foo:bar@localhost/baz',
array('user' => 'foo', 'password' => 'bar', 'host' => 'localhost', 'dbname' => 'baz', 'driver' => 'Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver'), 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 // DBAL-1234
'URL without scheme and without any driver information' => array( 'URL without scheme and without any driver information' => array(
......
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