Skip to content

Commit 0b6c055

Browse files
author
Marius Burkard
committed
- set mysqli reporting to OFF as it was prior to PHP 8.1
1 parent 7c33625 commit 0b6c055

File tree

5 files changed

+34
-23
lines changed

5 files changed

+34
-23
lines changed

install/lib/installer_base.lib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function check_prerequisites() {
249249
$msg = '';
250250

251251
if(version_compare(phpversion(), '5.4', '<')) $msg .= "PHP Version 5.4 or newer is required. The currently used PHP version is ".phpversion().".\n";
252-
if(version_compare(phpversion(), '8.0', '>=')) $msg .= "PHP Version 8 is not supported yet. Change PHP version back to the default version of the OS. The currently used PHP version is ".phpversion().".\n";
252+
if(version_compare(phpversion(), '8.2', '>=')) $msg .= "PHP Version 8.2+ is not supported yet. Change PHP version back to the default version of the OS. The currently used PHP version is ".phpversion().".\n";
253253
if(!function_exists('curl_init')) $msg .= "PHP Curl Module is missing.\n";
254254
if(!function_exists('mysqli_connect')) $msg .= "PHP MySQLi Module is nmissing.\n";
255255
if(!function_exists('mb_detect_encoding')) $msg .= "PHP Multibyte Module (MB) is missing.\n";

install/lib/mysql.lib.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ class db
6464
public function __destruct() {
6565
if($this->_iConnId) mysqli_close($this->_iConnId);
6666
}
67-
67+
6868
private function do_connect() {
6969
global $conf;
70+
71+
mysqli_report(MYSQLI_REPORT_OFF);
7072

7173
if($this->_iConnId) return true;
7274
$this->dbHost = $conf['mysql']['host'];
@@ -77,7 +79,7 @@ private function do_connect() {
7779
$this->dbCharset = $conf["mysql"]["charset"];
7880
$this->dbNewLink = false;
7981
$this->dbClientFlags = null;
80-
82+
8183
$this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort);
8284
$try = 0;
8385
while((!is_object($this->_iConnId) || mysqli_connect_error()) && $try < 5) {
@@ -92,19 +94,19 @@ private function do_connect() {
9294
$this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!');
9395
return false;
9496
}
95-
97+
9698
if($this->dbName) $this->setDBName($this->dbName);
9799

98100
$this->_setCharset();
99101
}
100-
102+
101103
public function setDBData($host, $user, $password, $port) {
102104
$this->dbHost = $host;
103105
$this->dbUser = $user;
104106
$this->dbPass = $password;
105107
$this->dbPort = $port;
106108
}
107-
109+
108110
public function setDBName($name) {
109111
$this->dbName = $name;
110112
$this->_iConnId = mysqli_connect($this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort);
@@ -114,7 +116,7 @@ public function setDBName($name) {
114116
return false;
115117
}
116118
}
117-
119+
118120
public function close() {
119121
if($this->_iConnId) mysqli_close($this->_iConnId);
120122
$this->_iConnId = null;
@@ -192,7 +194,7 @@ private function _setCharset() {
192194
}
193195

194196
private function _query($sQuery = '') {
195-
197+
196198
$aArgs = func_get_args();
197199
$this->do_connect();
198200

@@ -284,7 +286,7 @@ public function query($sQuery = '') {
284286
* @return array result row or NULL if none found
285287
*/
286288
public function queryOneRecord($sQuery = '') {
287-
289+
288290
$aArgs = func_get_args();
289291
if(!empty($aArgs)) {
290292
$sQuery = array_shift($aArgs);
@@ -293,7 +295,7 @@ public function queryOneRecord($sQuery = '') {
293295
}
294296
array_unshift($aArgs, $sQuery);
295297
}
296-
298+
297299
$oResult = call_user_func_array([&$this, 'query'], $aArgs);
298300
if(!$oResult) return null;
299301

@@ -534,7 +536,7 @@ function insert($tablename, $form, $debug = 0)
534536
if($debug == 1) echo "mySQL Error Message: ".$this->errorMessage;
535537
}
536538
}
537-
539+
538540
/* TODO: rewrite SQL */
539541
function update($tablename, $form, $bedingung, $debug = 0)
540542
{
@@ -761,14 +763,14 @@ public function mapType($metaType, $typeValue) {
761763
break;
762764
}
763765
}
764-
766+
765767
/**
766768
* Get the database type (mariadb or mysql)
767769
*
768770
* @access public
769771
* @return string 'mariadb' or string 'mysql'
770772
*/
771-
773+
772774
public function getDatabaseType() {
773775
$tmp = $this->queryOneRecord('SELECT VERSION() as version');
774776
if(stristr($tmp['version'],'mariadb')) {
@@ -777,15 +779,15 @@ public function getDatabaseType() {
777779
return 'mysql';
778780
}
779781
}
780-
782+
781783
/**
782784
* Get the database version
783785
*
784786
* @access public
785787
* @param bool $major_version_only = true will return the major version only, e.g. 8 for MySQL 8
786788
* @return string version number
787789
*/
788-
790+
789791
public function getDatabaseVersion($major_version_only = false) {
790792
$tmp = $this->queryOneRecord('SELECT VERSION() as version');
791793
$version = explode('-', $tmp['version']);

interface/lib/classes/db_mysql.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public function __construct($host = NULL , $user = NULL, $pass = NULL, $database
8282
$this->dbClientFlags = ($flags !== NULL) ? $flags : $conf['db_client_flags'];
8383
$this->_iConnId = mysqli_init();
8484

85+
mysqli_report(MYSQLI_REPORT_OFF);
86+
8587
mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags);
8688
for($try=0;(!is_object($this->_iConnId) || mysqli_connect_errno()) && $try < 5;++$try) {
8789
sleep($try);

server/lib/classes/db_mysql.inc.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public function __construct($host = NULL , $user = NULL, $pass = NULL, $database
8282
$this->dbClientFlags = ($flags !== NULL) ? $flags : $conf['db_client_flags'];
8383
$this->_iConnId = mysqli_init();
8484

85+
mysqli_report(MYSQLI_REPORT_OFF);
86+
8587
mysqli_real_connect($this->_iConnId, $this->dbHost, $this->dbUser, $this->dbPass, '', (int)$this->dbPort, NULL, $this->dbClientFlags);
8688
for($try=0;(!is_object($this->_iConnId) || mysqli_connect_errno()) && $try < 5;++$try) {
8789
sleep($try);

server/plugins-available/mysql_clientdb_plugin.inc.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ function process_host_list($action, $database_name, $database_user, $database_pa
166166
$link->escape_string($database_password));
167167
if(!$link->query($query)) $success = false;
168168
}
169-
169+
170170
$app->log("PASSWORD SET FOR '".$link->escape_string($database_user)."'@'$db_host' success? " . ($success ? 'yes' : 'no'), LOGLEVEL_DEBUG);
171-
171+
172172
if($success == true){
173173
$link->query("FLUSH PRIVILEGES");
174174
}
@@ -261,6 +261,7 @@ function db_insert($event_name, $data) {
261261
return;
262262
}
263263

264+
mysqli_report(MYSQLI_REPORT_OFF);
264265
//* Connect to the database
265266
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
266267
if ($link->connect_error) {
@@ -324,6 +325,7 @@ function db_update($event_name, $data) {
324325
return;
325326
}
326327

328+
mysqli_report(MYSQLI_REPORT_OFF);
327329
//* Connect to the database
328330
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
329331
if ($link->connect_error) {
@@ -654,6 +656,7 @@ function db_delete($event_name, $data) {
654656
return;
655657
}
656658

659+
mysqli_report(MYSQLI_REPORT_OFF);
657660
//* Connect to the database
658661
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
659662
if ($link->connect_error) {
@@ -709,6 +712,7 @@ function db_user_update($event_name, $data) {
709712
return;
710713
}
711714

715+
mysqli_report(MYSQLI_REPORT_OFF);
712716
//* Connect to the database
713717
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
714718
if ($link->connect_error) {
@@ -782,6 +786,7 @@ function db_user_delete($event_name, $data) {
782786
return;
783787
}
784788

789+
mysqli_report(MYSQLI_REPORT_OFF);
785790
//* Connect to the database
786791
$link = new mysqli($clientdb_host, $clientdb_user, $clientdb_password);
787792
if ($link->connect_error) {
@@ -807,16 +812,16 @@ function db_user_delete($event_name, $data) {
807812

808813
$link->close();
809814
}
810-
811-
812-
813-
815+
816+
817+
818+
814819
function getDatabaseType($link) {
815820
$result = $link->query('SELECT VERSION() as version');
816821
if($result) {
817822
$tmp = $result->fetch_assoc();
818823
$result->free();
819-
824+
820825
if(stristr($tmp['version'],'mariadb')) {
821826
return 'mariadb';
822827
} else {
@@ -832,7 +837,7 @@ function getDatabaseVersion($link, $major_version_only = false) {
832837
if($result) {
833838
$tmp = $result->fetch_assoc();
834839
$result->free();
835-
840+
836841
$version = explode('-', $tmp['version']);
837842
if($major_version_only == true) {
838843
$version_parts = explode('.', $version[0]);

0 commit comments

Comments
 (0)