diff --git a/resources/classes/database.php b/resources/classes/database.php index 2dfe9f471..cf185fd8b 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -1031,6 +1031,12 @@ class database { * @depends connect() */ public function table_exists(string $table_name) { + // Only add prefix if it's not already prefixed AND prefix is not empty + if (!empty(self::TABLE_PREFIX) && !str_starts_with($table_name, self::TABLE_PREFIX)) { + $table_name = self::TABLE_PREFIX . $table_name; + } + + // Check to see if the table was sanitized if (self::sanitize($table_name) != $table_name) { trigger_error('Table Name must be sanitized', E_USER_WARNING); return false;