Commit 0fdc5ca5 authored by Tim Schoondergang's avatar Tim Schoondergang
Browse files

Merge branch 'master' into '28-addparam-en-addcollection-toegevoegen'

# Conflicts:
#   src/TiMMiT/MySQL/DB.php
parents 827e3a70 383aaca3
Pipeline #7604 failed with stage
in 17 seconds
......@@ -248,6 +248,8 @@ class DB
{
try {
self::addToStats(__FUNCTION__);
mysqli_report(self::$mysqliReportingExceptionOn);
if (self::$writeActive && self::ping(true)) {
mysqli_close(self::$mlinkWrite);
}
......@@ -290,22 +292,30 @@ class DB
$mlink = self::$mlink;
}
}
if (!isset($mlink)) {
if (!isset($mlink) || is_null($mlink) || !is_object($mlink) || !isset($mlink->host_info)) {
return false;
}
mysqli_report(self::$mysqliReportingExceptionOn);
$returnValue = true;
try {
$result = mysqli_query($mlink, 'SELECT 1;');
if (!$result) {
$errorno = mysqli_errno($mlink);
if (!empty($errorno)) {
if ($errorno !== 0) {
$returnValue = false;
}
}
} catch (\mysqli_sql_exception $e) {
$returnValue = false;
} catch (\ErrorException $e) {
$returnValue = false;
} catch (\Throwable $e) {
$returnValue = false;
}
mysqli_report(self::$mysqliReportingExceptionOff);
return $returnValue;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment