Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions Sources/Db/APIs/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ public function query(string $db_string, array $db_values = [], ?object $connect
self::$cache[self::$count]['s'] = ($st = microtime(true)) - TIME_START;
}

$ret = @mysqli_query($connection, $db_string, self::$unbuffered ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);
$ret = mysqli_query($connection, $db_string, self::$unbuffered ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);

// Debugging.
if (DebugUtils::isDebugEnabled()) {
self::$cache[self::$count]['t'] = microtime(true) - $st;
}

if ($ret === false && empty($db_values['db_error_skip'])) {
list($file, $line) = $this->error_backtrace('', '', 'return', __FILE__, __LINE__);
Expand All @@ -239,11 +244,6 @@ public function query(string $db_string, array $db_values = [], ?object $connect
ErrorHandler::fatal($error_message, false);
}

// Debugging.
if (DebugUtils::isDebugEnabled()) {
self::$cache[self::$count]['t'] = microtime(true) - $st;
}

return $ret;
}

Expand Down Expand Up @@ -2513,7 +2513,7 @@ protected function initialize(array $options = []): void

// Either we aren't in SSI mode, or it failed.
if (empty($this->connection)) {
if (empty($options)) {
if (empty($options)) {
Comment thread
live627 marked this conversation as resolved.
Outdated
$options = ['dont_select_db' => SMF == 'SSI'];
}

Expand Down Expand Up @@ -2579,8 +2579,14 @@ protected function connect(string $user, string $passwd, array $options = []): v
ErrorHandler::displayDbError();
}

// Ignore some errors and strict mode warnings when we are not debugging.
mysqli_report(DebugUtils::isDebugEnabled() ? MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT : MYSQLI_REPORT_OFF);
// Available options:
// MYSQLI_REPORT_ALL => Set all options on (report all)
// MYSQLI_REPORT_ERROR => Report errors from mysqli function calls
// MYSQLI_REPORT_INDEX => Report if no index or bad index was used in a query
// MYSQLI_REPORT_STRICT => Throw a `mysqli_sql_exception` for errors instead of warnings
// MYSQLI_REPORT_OFF => Turns reporting off
// This was the default prior to PHP 8.1, and all our code assumes it.
mysqli_report(MYSQLI_REPORT_OFF);

$success = false;

Expand Down
Loading