]> source.dussan.org Git - nextcloud-server.git/commitdiff
Prevent leaking db connection info in the stacktrace
authorRobin Appelman <icewind@owncloud.com>
Tue, 6 Jan 2015 15:54:41 +0000 (16:54 +0100)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 7 Jan 2015 08:48:25 +0000 (09:48 +0100)
lib/private/db/connection.php

index b7981fcd6919e64f67b5050f3366bf7683fcf202..21c12f42d01564bb80c05fea7585c42ea0558638 100644 (file)
@@ -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
         */