aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/driver/mysqli.php
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:52:11 +0200
commit8ea437e30605e0f66b5220bf904a61d7c1d11ddd (patch)
treee0db2bb4a012d5b06a633160b19f62f4868ecd28 /phpBB/phpbb/db/driver/mysqli.php
parent36bc1870f21fac04736a1049c1d5b8e127d729f4 (diff)
parent2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff)
downloadforums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.gz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.bz2
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.tar.xz
forums-8ea437e30605e0f66b5220bf904a61d7c1d11ddd.zip
Merge remote-tracking branch 'upstream/prep-release-3.2.9'
Diffstat (limited to 'phpBB/phpbb/db/driver/mysqli.php')
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php52
1 files changed, 35 insertions, 17 deletions
diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index c0ddfbf76c..b429ad97aa 100644
--- a/phpBB/phpbb/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
@@ -68,15 +68,19 @@ class mysqli extends \phpbb\db\driver\mysql_base
if ($this->db_connect_id && $this->dbname != '')
{
+ // Disable loading local files on client side
+ @mysqli_options($this->db_connect_id, MYSQLI_OPT_LOCAL_INFILE, false);
+
@mysqli_query($this->db_connect_id, "SET NAMES 'utf8'");
// enforce strict mode on databases that support it
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');
- if ($result !== null)
+ if ($result)
{
- $row = @mysqli_fetch_assoc($result);
+ $row = mysqli_fetch_assoc($result);
+ mysqli_free_result($result);
$modes = array_map('trim', explode(',', $row['sql_mode']));
}
@@ -84,7 +88,6 @@ class mysqli extends \phpbb\db\driver\mysql_base
{
$modes = array();
}
- @mysqli_free_result($result);
// TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES
if (!in_array('TRADITIONAL', $modes))
@@ -119,9 +122,10 @@ 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');
- if ($result !== null)
+ if ($result)
{
- $row = @mysqli_fetch_assoc($result);
+ $row = mysqli_fetch_assoc($result);
+ mysqli_free_result($result);
$this->sql_server_version = $row['version'];
@@ -130,7 +134,6 @@ class mysqli extends \phpbb\db\driver\mysql_base
$cache->put('mysqli_version', $this->sql_server_version);
}
}
- @mysqli_free_result($result);
}
return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version;
@@ -202,6 +205,11 @@ class mysqli extends \phpbb\db\driver\mysql_base
$this->sql_time += microtime(true) - $this->curtime;
}
+ if (!$this->query_result)
+ {
+ return false;
+ }
+
if ($cache && $cache_ttl)
{
$this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl);
@@ -245,9 +253,9 @@ class mysqli extends \phpbb\db\driver\mysql_base
return $cache->sql_fetchrow($query_id);
}
- if ($query_id !== false && $query_id !== null)
+ if ($query_id)
{
- $result = @mysqli_fetch_assoc($query_id);
+ $result = mysqli_fetch_assoc($query_id);
return $result !== null ? $result : false;
}
@@ -271,7 +279,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
return $cache->sql_rowseek($rownum, $query_id);
}
- return ($query_id !== false) ? @mysqli_data_seek($query_id, $rownum) : false;
+ return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false;
}
/**
@@ -299,7 +307,17 @@ class mysqli extends \phpbb\db\driver\mysql_base
return $cache->sql_freeresult($query_id);
}
- return @mysqli_free_result($query_id);
+ if (!$query_id)
+ {
+ return false;
+ }
+
+ if ($query_id === true)
+ {
+ return true;
+ }
+
+ return mysqli_free_result($query_id);
}
/**
@@ -398,12 +416,12 @@ class mysqli extends \phpbb\db\driver\mysql_base
if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query"))
{
- while ($row = @mysqli_fetch_assoc($result))
+ while ($row = mysqli_fetch_assoc($result))
{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
+ mysqli_free_result($result);
}
- @mysqli_free_result($result);
if ($html_table)
{
@@ -418,7 +436,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;'))
{
$this->html_hold .= '<br />';
- while ($row = @mysqli_fetch_assoc($result))
+ while ($row = mysqli_fetch_assoc($result))
{
// make <unknown> HTML safe
if (!empty($row['Source_function']))
@@ -436,8 +454,8 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
+ mysqli_free_result($result);
}
- @mysqli_free_result($result);
if ($html_table)
{
@@ -455,14 +473,14 @@ class mysqli extends \phpbb\db\driver\mysql_base
$endtime = $endtime[0] + $endtime[1];
$result = @mysqli_query($this->db_connect_id, $query);
- if ($result !== null)
+ if ($result)
{
- while ($void = @mysqli_fetch_assoc($result))
+ while ($void = mysqli_fetch_assoc($result))
{
// Take the time spent on parsing rows into account
}
+ mysqli_free_result($result);
}
- @mysqli_free_result($result);
$splittime = explode(' ', microtime());
$splittime = $splittime[0] + $splittime[1];