Skip to content
This repository was archived by the owner on Feb 1, 2019. It is now read-only.
This repository was archived by the owner on Feb 1, 2019. It is now read-only.

Serialized custom field data is not imported correctly after being exported by the standard WordPress export/import plugin #70

@Scotchester

Description

@Scotchester

This is probably not a bug specific to CMS Toolkit, but I couldn't think of a better place to put it.

Example:

The milestone meta_value is stored in an array of strings:


"milestones": [
  "Determine how much you can afford to spend on a home",
  "Decide if it’s the right time to buy a new home",
  "Gather your application paperwork"
],

This data is exported to WordPress's XML format in a serialized form, like so:

…
<wp:postmeta>
    <wp:meta_key>milestones</wp:meta_key>
    <wp:meta_value><![CDATA[a:3:{i:0;s:52:"Determine how much you can afford to spend on a home";i:1;s:50:"Decide if it’s the right time to buy a new home ";i:2;s:34:"Gather your application paperwork ";}]]></wp:meta_value>
</wp:postmeta>
…

After attempting to import into a different WordPress installation, the JSON output for the field shows:


"milestones": [
  "a:0:{}",
  "a:3:{i:0;s:52:\"Determine how much you can afford to spend on a home\";i:1;s:50:\"Decide if it’s the right time to buy a new home \";i:2;s:34:\"Gather your application paperwork \";}"
],

For some reason, the data is not being correctly unserialized. It could be being exported incorrectly, imported incorrectly, or both.

Things we've tried:

  • Using WP-CLI to export and import the data. WP-CLI definitely doesn't export it correctly. It shows an empty serialized array:

    wp:postmeta
    wp:meta_keymilestones/wp:meta_key
    wp:meta_value/wp:meta_value
    /wp:postmeta

  • Adding a maybe_unserialize() call to the line in the import plugin's parser that sets meta values. Appears to have no effect.

I think the next step is a full step-by-step debugging of the import process.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions