julmud / phpDVDProfiler

Adoption of the defunct phpDVDProfiler
MIT License
1 stars 4 forks source link

Mysqli errors aren't displayed correctly if the DB connection is not working #37

Closed julmud closed 1 year ago

julmud commented 1 year ago

If the DB connection cannot be established, we either end up with no error message (in case of collection update) or with the following error and stack strace:

Fatal error: Uncaught ArgumentCountError: mysqli_error() expects exactly 1 argument, 0 given in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\mysqli.php:53
Stack trace:
#0 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\mysqli.php(53): mysqli_error()
#1 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\global.php(699): sql_db->__construct()
#2 D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\index.php(4): include_once('...')
#3 {main} thrown in D:\Web\~phpDVDProfiler\~~julmud (pre 1970)\3925c79-tv\mysqli.php on line 53

This is due to the fact that the mysqli_error and mysqli_errno method expect the DB connection as a parameter, and PHP is no longer silent about missing arguments.