diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-01-06 16:54:41 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-01-07 09:48:25 +0100 |
commit | bf1f9df590e45de4bb9a02c3f472ffdbe702bc69 (patch) | |
tree | 57ce3e46442990cf5054f101e53e0a4ee788a06f | |
parent | 2fd2b182e7b6711ee827bd5268c3a6e3fbad9ba5 (diff) | |
download | nextcloud-server-bf1f9df590e45de4bb9a02c3f472ffdbe702bc69.tar.gz nextcloud-server-bf1f9df590e45de4bb9a02c3f472ffdbe702bc69.zip |
Prevent leaking db connection info in the stacktrace
-rw-r--r-- | lib/private/db/connection.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/db/connection.php b/lib/private/db/connection.php index b7981fcd691..21c12f42d01 100644 --- a/lib/private/db/connection.php +++ b/lib/private/db/connection.php @@ -7,6 +7,7 @@ */ namespace OC\DB; +use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Driver; use Doctrine\DBAL\Configuration; use Doctrine\DBAL\Cache\QueryCacheProfile; @@ -23,6 +24,15 @@ class Connection extends \Doctrine\DBAL\Connection { */ protected $adapter; + public function connect() { + try { + return parent::connect(); + } catch (DBALException $e) { + // throw a new exception to prevent leaking info from the stacktrace + throw new DBALException($e->getMessage(), $e->getCode()); + } + } + /** * @var \Doctrine\DBAL\Driver\Statement[] $preparedQueries */ |