Skip to content

Commit d04eacc

Browse files
committed
FIX DB manipulations without an ID specified are now handled correctly
1 parent 7a99efa commit d04eacc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

code/AuditHook.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,18 @@ public static function handle_manipulation($manipulation)
9696
];
9797

9898
foreach ($manipulation as $table => $details) {
99-
if (!in_array($details['command'], array('update', 'insert'))) {
99+
if (!in_array($details['command'], ['update', 'insert'])) {
100100
continue;
101101
}
102102

103103
// logging writes to specific tables (just not when logging in, as it's noise)
104104
if (in_array($table, $watchedTables)
105105
&& !preg_match('/Security/', @$_SERVER['REQUEST_URI'])
106+
&& isset($details['id'])
106107
) {
107108
$className = $schema->tableClass($table);
108109

109-
$data = $className::get()->byId($details['id']);
110+
$data = $className::get()->byID($details['id']);
110111
if (!$data) {
111112
continue;
112113
}

0 commit comments

Comments
 (0)