PHP unserialize viewer
PHP 8.3Runs in your browserView PHP serialize() data as a tree or JSON and repair broken lengths.
PHP unserialize viewer
String with fixed lengths
Tree
JSON
How to use
- Paste a
serialize()string from a database or cache (shaped likea:2:{...}) to see it as a tree and as JSON. Flip the direction with the buttons above to turn JSON into a serialized string. - In
s:5:"hello", 5 is a byte count. If text changed during a migration and a length no longer fits, PHPunserialize()fails as a whole; here you get the line, column and real length of every bad spot, plus a repaired string. - Objects (
O:) are shown as a class name and properties only; nothing is created, so pasting strings from others is safe.
Good to know
- Korean letters take 3 bytes each in UTF-8, so
s:6:"한글"is correct. - Protected property names carry a
\0*\0prefix and private ones\0ClassName\0. The tree marks them with # and -. - Calling
unserialize()on untrusted input can create objects and run code (object injection). Use JSON for outside data, or pass['allowed_classes' => false]when you must.
Questions people ask
Why does unserialize return false?
Usually an s:number byte count no longer matches the text, for example after replacing a domain without fixing lengths. Paste it here to see the bad spots and get a repaired string.
Is it safe to paste strings that contain objects?
Yes. Our JavaScript only reads the text and never creates objects; you see the class name and properties.
What changes when converting to JSON?
Arrays with keys 0, 1, 2 in order become JSON arrays and everything else becomes JSON objects. Objects carry their class name in a __class field.