e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
318 stars 212 forks source link

[Bug]: PHP 8.2. fatal error if there are some issue with database #5220

Closed Jimmi08 closed 3 months ago

Jimmi08 commented 3 months ago

What e107 version are you using?

Latest Github version (just updated)

Bug description

If you have f.e. wrong database prefix, you will not get that familiar red message with class2.php error, but fatal error:

Fatal error: Uncaught Error: Undefined constant "e_LANGUAGE" in ***class2.php:1213 
Stack trace: 
#0 ***ehandlers/e_parse_class.php(5289): check_class(255) 
#1 ***ehandlers/e_parse_class.php(544): e_parse->cleanHtml('CORE_LAN8...') 
#2 ***ehandlers/admin_log_class.php(279): e_parse->toDB('CORE_LAN8', true, false, 'no_html') 
#3 ***ehandlers/admin_log_class.php(205): e_admin_log->addEvent(2, -1, 'CORE_LAN8', 'LAN_AL_CORE_LAN...', 'CORE_LAN7', false, 1, NULL) 
#4 ***class2.php(360): e_admin_log->add('LAN_AL_CORE_LAN...', 'CORE_LAN7', 2) 
#5 ***index.php(58): require_once('/data/7/8/78a5d...') 
#6 {main} thrown in ***class2.php on line 1213

How to reproduce

set wrong database prefix in config file

Expected behavior

red message about not able to connect to database

commenting those lines in check_class() helped this should be the result, not fatal error image

What browser(s) are you seeing the problem on?

Chrome / Brave

PHP Version

PHP 8.2