-
Notifications
You must be signed in to change notification settings - Fork 6
Description
When I try to make a backup the function backupTableData crashes at this line: return "'" . addslashes($value) . "'";
When I change this to return "'" . $value . "'"; the code runs correctly, but this doesn't prevent SQL-injection anymore.
On https://www.php.net/manual/en/function.addslashes.php there is this comment:
The addslashes() is sometimes incorrectly used to try to prevent SQL Injection.
Although the code runs now, it can give issues when trying to restore a database.
F.e. in my country (The Netherlands) we have names which contain an single quote (apostrof), like 's-Hertogenbosch, 's-Gravenhage, etc.
I have also looked at using htmlspecialchars($value) or htmlentities($value), but I dont think this will catch all the possibile UTF-8 characters?
Can you advice anything?
Best regards,
Cor van Dooren