- This topic has 5 replies, 2 voices, and was last updated 4 years, 8 months ago by
Steve.
-
AuthorPosts
-
-
May 8, 2017 at 11:52 pm #8203
hughcMemberI’ve struck this issue twice recently; 2 sites running the Events Calendar one Pro.
I’ve got corrupted post_meta values due to existing array data being double serialized.
The error manifests in a 500 when trying to save an Event. The code dies because it has pulled a string out of the database when it expected an Array.
If I disable Piklist, Events save correctly.
In browsing the issue, I read this: https://codex.wordpress.org/Function_Reference/maybe_serialize#Notes
in includes/class-piklist-meta.php
wp_save_post_revision_post_meta_serialize()looks like it does a maybe_serialize on raw values from the database, and then writes them back, without first checking whether the value is already serialized.
@sbruner or @jasontheadams , when should this code be triggered?Without a clear understanding of when this is called, I can’t be certain that this is the cause. But I’ve definitely got a conflict between Piklist 0.9.9.9+ and the Events Calendar.
-
May 9, 2017 at 12:53 am #8204
hughcMemberFWIW, I commented out the relevant lines in
wp_save_post_revision_post_meta_serialize()but the issue remains. There must be something else going on here. -
May 9, 2017 at 10:30 am #8206
SteveKeymasterTwo things to try:
1) Under Piklist > Settings. Make sure “Accelerate meta queries” is NOT checked.
2) Try our latest beta > -
May 10, 2017 at 9:52 pm #8226
hughcMemberOK I think I’ve tracked this down.
I’m using 1.1 beta2
in
Piklist_Revisionthere’s asave_posthook that appears to pull a raw value from the database, and then executes anadd_metadata()with the value that’s extracted.Disable the hook, Events save.
Enable the hook, I start seeing PHP Strings in the DB in place of Arrays and I get a 500 when saving Events.I added the following line @ line 56, before
add_metadata():$object->meta_value = maybe_unserialize($object->meta_value);Values end up in the database, clean, and Events are saving OK.
The only issue that I can see, at a database level, is that the metadata values are doubled up, but this may be a hangover from an original issue, where at some point duplicates were created and now values are being slavishly copied from one revision to another perpetuating the duplicates.
What is the
save_posthook trying to achieve? Transcription of piklist-specific values from one post revision to another? -
May 22, 2017 at 2:29 am #8245
-
May 22, 2017 at 9:52 am #8246
-
-
AuthorPosts
- You must be logged in to reply to this topic.