aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/driver
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/db/driver')
-rw-r--r--phpBB/phpbb/db/driver/mssqlnative.php6
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php37
2 files changed, 28 insertions, 15 deletions
diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
index 9639bfa988..a7f93c8feb 100644
--- a/phpBB/phpbb/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
@@ -319,10 +319,10 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
{
foreach ($errors as $error)
{
- $error_message .= "SQLSTATE: " . $error[ 'SQLSTATE'] . "\n";
- $error_message .= "code: " . $error[ 'code'] . "\n";
+ $error_message .= "SQLSTATE: " . $error['SQLSTATE'] . "\n";
+ $error_message .= "code: " . $error['code'] . "\n";
$code = $error['code'];
- $error_message .= "message: " . $error[ 'message'] . "\n";
+ $error_message .= "message: " . $error['message'] . "\n";
}
$this->last_error_result = $error_message;
$error = $this->last_error_result;
diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index 58361ff0f8..520bb65b67 100644
--- a/phpBB/phpbb/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
@@ -71,10 +71,17 @@ class mysqli extends \phpbb\db\driver\mysql_base
if (version_compare($this->sql_server_info(true), '5.0.2', '>='))
{
$result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode');
- $row = @mysqli_fetch_assoc($result);
- @mysqli_free_result($result);
+ if ($result !== null)
+ {
+ $row = @mysqli_fetch_assoc($result);
- $modes = array_map('trim', explode(',', $row['sql_mode']));
+ $modes = array_map('trim', explode(',', $row['sql_mode']));
+ }
+ else
+ {
+ $modes = array();
+ }
+ @mysqli_free_result($result);
// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
if (!in_array('TRADITIONAL', $modes))
@@ -109,15 +116,18 @@ class mysqli extends \phpbb\db\driver\mysql_base
if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false)
{
$result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version');
- $row = @mysqli_fetch_assoc($result);
- @mysqli_free_result($result);
+ if ($result !== null)
+ {
+ $row = @mysqli_fetch_assoc($result);
- $this->sql_server_version = $row['version'];
+ $this->sql_server_version = $row['version'];
- if (!empty($cache) && $use_cache)
- {
- $cache->put('mysqli_version', $this->sql_server_version);
+ if (!empty($cache) && $use_cache)
+ {
+ $cache->put('mysqli_version', $this->sql_server_version);
+ }
}
+ @mysqli_free_result($result);
}
return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version;
@@ -224,7 +234,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
return $cache->sql_fetchrow($query_id);
}
- if ($query_id !== false)
+ if ($query_id !== false && $query_id !== null)
{
$result = @mysqli_fetch_assoc($query_id);
return $result !== null ? $result : false;
@@ -434,9 +444,12 @@ class mysqli extends \phpbb\db\driver\mysql_base
$endtime = $endtime[0] + $endtime[1];
$result = @mysqli_query($this->db_connect_id, $query);
- while ($void = @mysqli_fetch_assoc($result))
+ if ($result !== null)
{
- // Take the time spent on parsing rows into account
+ while ($void = @mysqli_fetch_assoc($result))
+ {
+ // Take the time spent on parsing rows into account
+ }
}
@mysqli_free_result($result);