Bug: Incorrect Display of Escaped JSON Strings in Redis Value Viewer (Breaks HTML Rendering in JSON Objects)
What version of phpCacheAdmin are you using?
2.3.1
Cache system and version
No response
Extension or client and version
No response
PHP Version
8.4.14
Operating System
AlmaLinux 8
Describe the issue
phpCacheAdmin’s value viewer misrepresents valid JSON strings containing escaped HTML.
It shows <\/a> and \" as literal characters instead of rendering the decoded, clean HTML that json_decode() produces in PHP.
This creates false appearance of data corruption, even though:
- The Redis data is valid JSON
- json_decode() in PHP works perfectly
- The application renders correct HTML
The issue is purely visual in the UI and does not affect data integrity.
Steps to Reproduce:
- Store a JSON string in Redis containing HTML with closing tags (e.g.,
</a>) and double quotes. - View the key in phpCacheAdmin.
- Observe broken display:
<\/a>and\"remain escaped.
Expected Behavior: The viewer should either: Show raw escaped JSON (like redis-cli) Or decode and display clean HTML (like after json_decode())
Actual Behavior:
Partial unescaping breaks the preview:
<\/a> remains as <\/a> (not converted to </a>)
\" remains as \" (not converted to ")
Result: HTML appears broken and unreadable.
Not sure if you were done with the fix or not, but I did try the updated scripts.js and had the same issues. Figure I'd let you know before a new release cycle.
Issue Example - Seen in phpCacheAdmin:
{
"html": "
\"Track
Empress<\/a>
In Service: 1990<\/span><\/li>",
"total_count": 1,
"upcoming_count": 0
}
Actual stored in redis:
"{\"html\":\"<li><a href=\\\"\\/ship-tracker\\/cordelia-cruises\\/empress\\/\\\" title=\\\"Empress Cruise Ship Tracker\\\"><img src=\\\"\\/images\\/ships\\/cordelia-cruises\\/empress.webp\\\" alt=\\\"Track Empress in real-time\\\" width=\\\"500\\\" height=\\\"250\\\" loading=\\\"lazy\\\"><br \\/>Empress<\\/a><span class=\\\"ship-category-class-inservice\\\"><br \\/>In Service: 1990<\\/span><\\/li>\",\"total_count\":1,\"upcoming_count\":0}"
This should be visual bug with custom json highlighter.
Here https://github.com/RobiNN1/phpCacheAdmin/blob/master/src/Value.php#L66C27-L66C51 remove class="json-code" to disable it and let me know if it fixed it.
That definitely fixed it. Just no more pretty highlighting. Thanks.
I'll remove it. There are probably more issues and I don't want to add a whole js library just for JSON highlighting.