From e0d06ee83ebf9ae72ef9746385155168fb083fa9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 22 Oct 2015 11:27:03 +0200 Subject: [ticket/14044] Fix Sqlite error in tests PHPBB3-14044 --- phpBB/phpbb/db/driver/sqlite3.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'phpBB/phpbb/db') diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php index b7f6e60337..2000acb251 100644 --- a/phpBB/phpbb/db/driver/sqlite3.php +++ b/phpBB/phpbb/db/driver/sqlite3.php @@ -136,7 +136,19 @@ class sqlite3 extends \phpbb\db\driver\driver { if (($this->query_result = @$this->dbo->query($query)) === false) { - $this->sql_error($query); + // Try to recover a lost database connection + if ($this->dbo && !@$this->dbo->lastErrorMsg()) + { + if ($this->sql_connect($this->server, $this->user, '', $this->dbname)) + { + $this->query_result = @$this->dbo->query($query); + } + } + + if ($this->query_result === false) + { + $this->sql_error($query); + } } if (defined('DEBUG')) -- cgit v1.2.1