aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/download/file.php4
-rw-r--r--phpBB/includes/db/dbal.php8
2 files changed, 11 insertions, 1 deletions
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index 09677738a5..dc3a14eb4c 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -479,6 +479,10 @@ function send_file_to_browser($attachment, $upload_dir, $category)
{
header("Content-Length: $size");
}
+
+ // Close the db connection before sending the file
+ $db->sql_close();
+
if (!set_modified_headers($attachment['filetime'], $user->browser))
{
// Try to deliver in chunks
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index e55a565ea4..6bec685061 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -138,7 +138,13 @@ class dbal
$this->sql_freeresult($query_id);
}
- return $this->_sql_close();
+ // Connection closed correctly. Set db_connect_id to false to prevent errors
+ if (($result = $this->_sql_close()))
+ {
+ $this->db_connect_id = false;
+ }
+
+ return $result;
}
/**