0

I am having a problem with WP serialization. To cut a long story short: the problem appeared two months after the site launch. All the strings of text that were stored as a theme_option or as a meta box all turned into a letter "A". I guess it happened when WP self-updated to version 3.8.1, but I can't really be sure...

At first - I thought it's a plugin bug. I use Option Tree as a solution to store theme options and meta boxes. I started an issue on the plugin's repo on github. The author of the plugin hasn't answered yet but after some digging and var_dumping I noticed that not only Option Tree's strings were "A"s but also Contact Form 7's. There on github I've described in more details.

To solve the issue of "A"s of theme_options I wrapped the string in the @unserialize function - and it worked well. But the meta boxes remain. This solution is a temporary fix.

So I'm at a loss ). You can see the problem online at http://saikoteam.by (mind it's in Russian). The Warnings there - are a result of different foreach loops getting string("a") instead of an array of values.

I will be glad if anyone could point me to the direction of solving the issue.

| improve this question | | | | |
  • Have you been able to replicate the original issue on an install that doesn't have the problem? What does the serialised form look like? Can you post that then what the unserialised form is ( probably just an A but do it anyway for completeness ). What do you think caused it to do this? Could it be that it happened earlier and you only noticed it 2 months later? Has anybody attempted a search replace to change the URL of the site? – Tom J Nowell Apr 1 '14 at 10:43
  • Have you been able to replicate the original issue on an install that doesn't have the problem? - no, on my local installation (without the auto-update) everything is good. The only thing that I tried is reinstall WP (deleted all the files and opened wp-admin/upgrade.php. Didn't help. – skip405 Apr 1 '14 at 10:51
  • @TomJNowell, Could it be that it happened earlier and you only noticed it 2 months later? I guess not, as I said, the only logical thing that may have caused it is the auto-update. – skip405 Apr 1 '14 at 11:08
  • @TomJNowell, What does the serialised form look like? the Warning comes from a file form.php - this is just a template file that I include. In this file I simply retrieve the value of the meta field. While retrieving WP does not seem to run the maybe_unserialize function - and simply returns the serialized value. That's what's happening, imo. In case of the theme options I managed to find the needed variable and forced @unserialize on it myself. Before that - half of the site was in "a"s )) – skip405 Apr 1 '14 at 11:13
  • 1
    @skip405 can you take it directly from the database using an SQL client so that it's unprocessed by WordPress? A screenshot PNG file is not something I can copy paste into tools or linters to validate, and I cant do searches on them, it's useless to me, and it's not the original raw value either. Preferably via gist.github.com or another pastebin – Tom J Nowell Apr 1 '14 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.