]> 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)
committerRobin Appelman <icewind@owncloud.com>
Tue, 6 Jan 2015 15:54:41 +0000 (16:54 +0100)
lib/private/db/connection.php

index d10adee558c747c2c830eabab054efeac8c99dd7..f2fcd8730afa0665f756abdf5291823d6a0fb534 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;
@@ -24,6 +25,15 @@ class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
         */
        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());
+               }
+       }
+
        /**
         * Initializes a new instance of the Connection class.
         *