From 86cecf8cfb92811a5d9d9f8031184eb0ddb2b681 Mon Sep 17 00:00:00 2001 From: rootcoma Date: Wed, 27 Nov 2013 03:38:43 -0800 Subject: [PATCH] Set $this->db=null on errors in connect --- php/includes/storage.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/php/includes/storage.php b/php/includes/storage.php index e03cc94..4090c48 100644 --- a/php/includes/storage.php +++ b/php/includes/storage.php @@ -16,10 +16,11 @@ try { $this->db = new PDO($this->dbType . $this->dbLocation); if(!$this->db) { - throw new StorageConnectionException($err); + $this->db = null; + throw new StorageConnectionException(); } } catch (Exception $e) { - + $this->db = null; } } } @@ -298,4 +299,4 @@ class StorageSchemaException extends StorageException { } - class StorageConnectionException extends StorageException { } \ No newline at end of file + class StorageConnectionException extends StorageException { }