An SQL error is displayed when trying to remove a customer.
System information
Froxlor version: 2.2.0-rc3
Web server: Apache/2.4.58
MySQL server: 10.11.8-MariaDB-0ubuntu0.24.04.1
OS/Version: Ubuntu 24.04
To Reproduce
Steps to reproduce the behavior:
Go to 'Customers'
Click on 'Delete'
Confirm
See error :-)
Expected behavior
The user should be removed without stopping the execution.
Logfiles
SQLSTATE[42000]: Syntax error or access violation: 1141 There is no such grant defined for user 'XYZ' on host 'A.B.C.D'
Additional context
The code in lib/Froxlor/Database/Manager/DbManagerMySQL.php @ 190 compares the PDO::ATTR_SERVER_VERSION to the simple string '5.0.2':
if (Database::getAttribute(PDO::ATTR_SERVER_VERSION) < '5.0.2') {
// Revoke privileges (only required for MySQL 4.1.2 - 5.0.1)
$stmt = Database::prepare("REVOKE ALL PRIVILEGES ON * . * FROM `" . $username . "`@`" . $host . "`");
Database::pexecute($stmt);
}
The comparison should make use of version_compare() as on line 196:
// as of MySQL 5.0.2 this also revokes privileges. (requires MySQL 4.1.2+)
if (version_compare(Database::getAttribute(PDO::ATTR_SERVER_VERSION), '5.7.0', '<')) {
$stmt = Database::prepare("DROP USER :username@:host");
} else {
$stmt = Database::prepare("DROP USER IF EXISTS :username@:host");
}
Database::pexecute($stmt, [
"username" => $username,
"host" => $host
]);
An SQL error is displayed when trying to remove a customer.
System information
To Reproduce Steps to reproduce the behavior:
Expected behavior The user should be removed without stopping the execution.
Logfiles SQLSTATE[42000]: Syntax error or access violation: 1141 There is no such grant defined for user 'XYZ' on host 'A.B.C.D'
Additional context The code in lib/Froxlor/Database/Manager/DbManagerMySQL.php @ 190 compares the PDO::ATTR_SERVER_VERSION to the simple string '5.0.2':
The comparison should make use of version_compare() as on line 196: