Bernd Wurst commited on 2017-02-06 11:35:00
Zeige 1 geänderte Dateien mit 4 Einfügungen und 3 Löschungen.
| ... | ... |
@@ -55,8 +55,9 @@ class DB extends PDO {
|
| 55 | 55 |
strtoupper(substr($stmt, 0, 7)) == "REPLACE" || |
| 56 | 56 |
strpos(strtoupper($stmt), "WHERE") > 0) { // Das steht nie am Anfang
|
| 57 | 57 |
$backtrace = debug_backtrace(); |
| 58 |
- if (config("enable_debug")) {
|
|
| 59 |
- warning("Unsafe SQL statement in {$backtrace[1]['file']} line {$backtrace[1]['line']}");
|
|
| 58 |
+ $wherepart = substr(strtoupper($stmt), strpos(strtoupper($stmt), "WHERE")); |
|
| 59 |
+ if ((strpos($wherepart, '"') > 0 || strpos($wherepart, "'") > 0) && config("enable_debug")) {
|
|
| 60 |
+ warning("Possibly unsafe SQL statement in {$backtrace[1]['file']} line {$backtrace[1]['line']}:\n$stmt");
|
|
| 60 | 61 |
} |
| 61 | 62 |
} |
| 62 | 63 |
return parent::query($stmt); |
| ... | ... |
@@ -132,7 +133,7 @@ function db_query($stmt, $params = NULL) |
| 132 | 133 |
} catch (PDOException $e) {
|
| 133 | 134 |
global $debugmode; |
| 134 | 135 |
if ($debugmode) {
|
| 135 |
- system_failure("MySQL-Fehler: ".$e->getMessage()."\nQuery:\n".$stmt);
|
|
| 136 |
+ system_failure("MySQL-Fehler: ".$e->getMessage()."\nQuery:\n".$stmt."\nParameters:\n".print_r($params, true));
|
|
| 136 | 137 |
} else {
|
| 137 | 138 |
system_failure("Datenbankfehler");
|
| 138 | 139 |
} |
| 139 | 140 |