Skip to content
Accessibility
Theme
Text size
High contrast
Limit animations
Readable fontAtkinson Hyperlegible
Increased text spacing
Underline links
Always show focus

Runs in your browser — nothing you paste is uploaded.

Fix Broken Serialized Data

Did a database search-replace leave WordPress unable to read an option? Paste the broken serialized string — this recomputes every s:LEN: byte-length and verifies the result unserializes. Runs in your browser.

Every s:LEN:"…"; gets its length recomputed from the actual UTF-8 bytes. Other tokens are left untouched.


      

What went wrong

PHP serialize() writes each string as s:<bytes>:"<text>";. The number is the string's length in bytes. When you run a plain SQL UPDATE … REPLACE() or a text find-and-replace across a database dump — for example changing a domain during a site migration — the text inside the quotes changes but the s:19: prefix does not. PHP then reads the wrong number of bytes, unserialize() returns false, and the setting, widget, or page-builder layout silently reverts or disappears.

How the fix works

This tool scans for every s:LEN:"…"; token and rewrites LEN to the true UTF-8 byte length of the text it contains, then attempts a full unserialize() to confirm the whole structure is valid again. If it still fails, you'll see where.

Example

Broken — the URL was lengthened by a replace but the length still says 19:

a:1:{s:8:"site_url";s:19:"https://newdomain.example";}

Repaired — length corrected to the real byte count, so it unserializes:

a:1:{s:8:"site_url";s:25:"https://newdomain.example";}

Prevent it next time

For whole-database replacements use a serialization-aware tool: wp search-replace (WP-CLI), the Better Search Replace plugin, or interconnect/it's Search Replace DB script. They walk the serialized structure and fix lengths as they go. Use this page for one-off values you're editing by hand, or to rescue data already damaged by a raw replace.

Limitations

This is a text-level repair. If a replaced string itself contains the sequence ";, the token boundary can be ambiguous and the repair may need manual review — always check the verification line and test on a copy before writing back to a live database. Serialized PHP objects (O:) are not repaired. Need to build or read a value from scratch instead? Use PHP Serialize & Unserialize.

Related tools