Skip to content

PHP Fatal error: Uncaught Error: Class 'database' not found in functions.php #1247

@LuisCardenasSolis

Description

@LuisCardenasSolis

Error to start Mailwatch : Class 'database' not found

if (isset($_COOKIE['MW_LANG']) && checkLangCode($_COOKIE['MW_LANG'])) {

require_once __DIR__ . '/database.php';

The code in line 69 of the functions.php file indirectly uses the database class that comes from importing the database.php file.
The checkLangCode() function makes use of the audit_log() function, which requires the dbconn() function, which would only work with the database class already imported, but it is still called on line 103, causing the error "PHP Fatal error: Uncaught Error : Class 'database' not found in /var/www/html/mailscanner/functions.php"

The workaround is to move the database.php file import to the top (after conf.php import: line 41)

require_once __DIR__ . '/conf.php';
require_once __DIR__ . '/database.php';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions