From 56013aa61028957e452dcdca18a9ad709840d46d Mon Sep 17 00:00:00 2001 From: Ortwin Pinke Date: Thu, 27 Jan 2022 19:46:05 +0100 Subject: [PATCH] fixes PHP 8.1 --- .htaccess | 4 +-- conlib/db_mysqli.inc | 58 +++++++++++++++++++++++--------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.htaccess b/.htaccess index 6762b78..7864d7c 100644 --- a/.htaccess +++ b/.htaccess @@ -33,7 +33,7 @@ RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} ftp://.*$ [NC,OR] RewriteCond %{QUERY_STRING} http[s]*://.*$ [NC] - RewriteRule ^.* - [F,L] # all matching conditions from above will end in nirvana + RewriteRule ^.* - [F,L,DPI] # all matching conditions from above will end in nirvana # Rewrite request to root to front_content.php RewriteRule ^$ front_content.php [QSA,L] @@ -44,7 +44,7 @@ RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d - RewriteRule ^.*$ - [NC,L] + RewriteRule ^.*$ - [NC,L,DPI] # Pass other requests to front_content.php RewriteRule ^.*$ front_content.php [QSA,NC,L] diff --git a/conlib/db_mysqli.inc b/conlib/db_mysqli.inc index efff09b..f183533 100644 --- a/conlib/db_mysqli.inc +++ b/conlib/db_mysqli.inc @@ -92,6 +92,10 @@ class DB_Sql extends DB_Sql_Abstract { return null; } + // PHP 8.1 fix + $driver = new mysqli_driver(); + $driver->report_mode = MYSQLI_REPORT_OFF; + $dbh = mysqli_init(); //print_r($dbh); if (!$dbh) { @@ -123,7 +127,7 @@ class DB_Sql extends DB_Sql_Abstract { $aCon['socket'] = null; } if (!isset($aCon['flags'])) { - $aCon['flags'] = null; + $aCon['flags'] = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT; } if (!isset($aCon['database'])) { $aCon['database'] = null; @@ -326,30 +330,30 @@ class DB_Sql extends DB_Sql_Abstract { } /** - * @see DB_Sql_Abstract::_metaData() - * * Due to compatibility problems with Table we changed the behavior - * of metadata(); - * depending on $full, metadata returns the following values: - * - * - full is false (default): - * $result[]: - * [0]["table"] table name - * [0]["name"] field name - * [0]["type"] field type - * [0]["len"] field length - * [0]["flags"] field flags - * - * - full is true - * $result[]: - * ["num_fields"] number of metadata records - * [0]["table"] table name - * [0]["name"] field name - * [0]["type"] field type - * [0]["len"] field length - * [0]["flags"] field flags - * ["meta"][field name] index of field named "field name" - * This last one could be used if you have a field name, but no index. - * Test: if (isset($result['meta']['myfield'])) { ... + * @see DB_Sql_Abstract::_metaData() + * * Due to compatibility problems with Table we changed the behavior + * of metadata(); + * depending on $full, metadata returns the following values: + * + * - full is false (default): + * $result[]: + * [0]["table"] table name + * [0]["name"] field name + * [0]["type"] field type + * [0]["len"] field length + * [0]["flags"] field flags + * + * - full is true + * $result[]: + * ["num_fields"] number of metadata records + * [0]["table"] table name + * [0]["name"] field name + * [0]["type"] field type + * [0]["len"] field length + * [0]["flags"] field flags + * ["meta"][field name] index of field named "field name" + * This last one could be used if you have a field name, but no index. + * Test: if (isset($result['meta']['myfield'])) { ... */ protected function _metaData($table = '', $full = false) { $count = 0; @@ -392,7 +396,7 @@ class DB_Sql extends DB_Sql_Abstract { $count = 0; while ($finfo = $id->fetch_field()) { - //rint_r($finfo); + //rint_r($finfo); $res[$count]['table'] = $finfo->table; $res[$count]['name'] = $finfo->name; $res[$count]['type'] = $this->_aDataTypes[$finfo->type]; @@ -440,7 +444,7 @@ class DB_Sql extends DB_Sql_Abstract { $return[$i]['table_name'] = $info[0]; $return[$i]['tablespace_name'] = $this->Database; $return[$i]['database'] = $this->Database; - $i ++; + $i++; } mysqli_free_result($h);