Enhance decodeData method to better handle double-escaped JSON by adding additional decoding attempts.

This commit is contained in:
Jeppe Bundgaard
2026-01-06 11:51:48 +01:00
parent d244294dd9
commit 3bca46c457
@@ -118,6 +118,17 @@ class module_action_logs_o extends db
if ($decoded === null) {
$decoded = json_decode(htmlspecialchars_decode($data), true);
}
// If it's still null, try stripping slashes - common when data is double escaped in DB
if ($decoded === null) {
$decoded = json_decode(stripslashes($data), true);
}
// Final attempt: stripslashes + htmlspecialchars_decode
if ($decoded === null) {
$decoded = json_decode(stripslashes(htmlspecialchars_decode($data)), true);
}
return is_array($decoded) ? $decoded : [];
}
}