Due to a bug (#1871020: Conflict with Workbench Moderation: tags revert to defaults after moderation change) it is possible that some meta tag data might have been serialized twice. Add an update script to fix this.

Comments

damienmckenna’s picture

Title: Fix any meta tags that may have been double-serialized » Fix any meta tags that may have been serialized twice
damienmckenna’s picture

Category: bug » task
Status: Active » Needs review
StatusFileSize
new1.49 KB

This should take care of the problem, it searches for records with arrays that are three levels deep and removes the outer array.

willvincent’s picture

Maybe I'm missing something, or not fully understanding the magic of reset(), but I don't see how the logic for fixing corrupt data is removing the extraneous elements.

Specifically in a case where you might end up with an array something like this:

$arr['und']['und'][....

Which is what I previously observed in the data structure that I was getting with beta4.

Also, are you certain the query to find corrupt entries is fully effective? Seems to me it might be better to simply iterate through all records and fix any that are broken (by testing them after unserializing). A bit less performant perhaps, but since it's a one-time update script that shouldn't matter as much.

If I'm totally off base, go ahead and ignore my ramblings here.. just want to be sure we get this licked. ;)

damienmckenna’s picture

Status: Needs review » Needs work

@willvincent: That's a completely valid point, the patch doesn't account for the same problem happening repeatedly on the same records.

damienmckenna’s picture

BTW the code will take something like this:

Array(
  'und' => Array(
    'title => 'Monkey',
  ),
)

and turn it into this:

Array(
  'title => 'Monkey',
)
damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.27 KB

Going to leave it to just run once.

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

damienmckenna’s picture

Status: Fixed » Closed (fixed)

Now that Metatag v7.x-1.0-beta5 is out am closing this to keep the issue queue clean.