From 675867078402e769d0ce61c6d3e631fd2fa45e44 Mon Sep 17 00:00:00 2001 From: Roman Parpalak Date: Fri, 28 Jul 2023 00:16:42 +0300 Subject: [PATCH] Fixed some incompatibilities with PHP 8.2 --- _admin/install.php | 6 +++--- _include/dblayer/mysqli.php | 3 ++- _include/dblayer/mysqli_innodb.php | 3 ++- _include/utf8/utf8.php | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/_admin/install.php b/_admin/install.php index e920000a..c8e81914 100644 --- a/_admin/install.php +++ b/_admin/install.php @@ -56,7 +56,7 @@ function generate_config_file () { $url_prefix = $prefix; $content = s2_get_remote_file($base_url.$url_prefix.'/this/URL/_DoEs_/_NoT_/_eXiSt', 5, false, 10, true); - if (false !== strpos($content['content'], '')) + if ($content !== null && false !== strpos($content['content'], '')) break; } @@ -68,7 +68,7 @@ function generate_config_file () else { $content = s2_get_remote_file('https://'.substr($base_url, 7).$url_prefix.'/this/URL/_DoEs_/_NoT_/_eXiSt', 5, false, 10, true); - if (false !== strpos($content['content'], '')) + if ($content !== null && false !== strpos($content['content'], '')) $use_https = true; } @@ -410,7 +410,7 @@ function get_preferred_lang ($languages) // function unescape($str) { - return (get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str; + return (PHP_VERSION_ID < 70400 && get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str; } $db_type = $_POST['req_db_type']; diff --git a/_include/dblayer/mysqli.php b/_include/dblayer/mysqli.php index f86c20f1..ae2dded8 100644 --- a/_include/dblayer/mysqli.php +++ b/_include/dblayer/mysqli.php @@ -41,6 +41,7 @@ public function __construct($db_host, $db_username, $db_password, $db_name, $db_ // Persistent connection in MySQLi are only available in PHP 5.3 and later releases $p_connect = $p_connect && version_compare(PHP_VERSION, '5.3.0', '>=') ? 'p:' : ''; + mysqli_report(MYSQLI_REPORT_OFF); if (isset($db_port)) $this->link_id = @mysqli_connect($p_connect.$db_host, $db_username, $db_password, $db_name, $db_port); else @@ -251,7 +252,7 @@ function close() { if ($this->link_id) { - if ($this->query_result) + if (!is_bool($this->query_result)) @mysqli_free_result($this->query_result); return @mysqli_close($this->link_id); diff --git a/_include/dblayer/mysqli_innodb.php b/_include/dblayer/mysqli_innodb.php index c9b9be03..e2f0e789 100644 --- a/_include/dblayer/mysqli_innodb.php +++ b/_include/dblayer/mysqli_innodb.php @@ -42,6 +42,7 @@ public function __construct($db_host, $db_username, $db_password, $db_name, $db_ // Persistent connection in MySQLi are only available in PHP 5.3 and later releases $p_connect = $p_connect && version_compare(PHP_VERSION, '5.3.0', '>=') ? 'p:' : ''; + mysqli_report(MYSQLI_REPORT_OFF); if (isset($db_port)) $this->link_id = @mysqli_connect($p_connect.$db_host, $db_username, $db_password, $db_name, $db_port); else @@ -264,7 +265,7 @@ function close() { if ($this->link_id) { - if ($this->query_result) + if (!is_bool($this->query_result)) @mysqli_free_result($this->query_result); return @mysqli_close($this->link_id); diff --git a/_include/utf8/utf8.php b/_include/utf8/utf8.php index 3371fe4a..3479a036 100644 --- a/_include/utf8/utf8.php +++ b/_include/utf8/utf8.php @@ -38,7 +38,7 @@ * encoding */ if ( extension_loaded('mbstring')) { - if ( ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING ) { + if ( PHP_VERSION_ID < 70200 && (ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING )) { trigger_error('String functions are overloaded by mbstring',E_USER_ERROR); } mb_internal_encoding('UTF-8');