From b58fda1c46078de9cd5469c3e6df3c0db269a9b6 Mon Sep 17 00:00:00 2001 From: afluegel9 <97666499+afluegel9@users.noreply.github.com> Date: Wed, 6 Jul 2022 09:10:32 +0200 Subject: [PATCH] Update wrapper-mysql.php The order or arguments in the exception constructor is wrong. This is only visible, when mysqli is not available, thus the author quite likely never saw this for the user misleading error message: PHP Fatal error: Uncaught TypeError: Exception::__construct(): Argument #2 ($code) must be of type int, string given in Standard input code:2 Stack trace: #0 Standard input code(2): Exception->__construct() #1 {main} thrown in Standard input code on line 58 --- src/wrapper-mysql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wrapper-mysql.php b/src/wrapper-mysql.php index 49b8d0f..92b185a 100644 --- a/src/wrapper-mysql.php +++ b/src/wrapper-mysql.php @@ -55,7 +55,7 @@ function is_myresource ($o, $onlyres = false) { if ( ! function_exists ('mysql_connect') ) { if ( ! extension_loaded ('mysqli') ) { - throw new Exception (E_ERROR, 'MySQL wrapper must need mysqli extension'); + throw new Exception ('MySQL wrapper needs the mysqli extension', E_ERROR); } if ( ! function_exists ('___ini_get') ) { @@ -1693,4 +1693,4 @@ function mysql_global_resource (&$c, $argc, $noerr = false) { function mysql_trigger_msg ($msg, $tr) { return sprintf ('%s: %s in %s on lien %d', $tr['function'], $msg, $tr['file'], $tr['line']); } -} \ No newline at end of file +}