Site icon Anthony Carbon

PHP Notice: unserialize(): Error at offset of bytes

PHP Notice: unserialize(): Error at offset of bytes is showing when you edited the serialized text. In my end, I have serialized text and change the text. This will mess up serialized character count. This error show on my end `PHP Notice: unserialize(): Error at offset 2025 of 3529 bytes` and to fix the issue, do not touch any text within the serialized text.

You can edit the serialized text if you are knowledgeable on how to replace the counting of every character.

Example:

a:3:{s:7:"widgets";a:3:{i:0;a:16:{s:13:"attachment_id";i:3145;s:3:"url";......

If you can see every value like `widgets`, `attachment_id`, and `url` has character count on the left. `widgets` is 7 character (s:7:”widgets”;), `attachment_id` is 13 character (s:13:”attachment_id”;), and `url` is 3 character (s:3:”url”;).

Example I want to rename `widgets` to `widget`, the the character count will be 6 instead of 7 (s:6:”widgets”;).

Hopefully this post help you a lot.

Happy coding everyone 🙂

Exit mobile version