Enhance decodeData method to better handle double-escaped JSON by adding additional decoding attempts.
This commit is contained in:
@@ -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 : [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user