[wp-trac] [WordPress Trac] #36818: Export filter for post meta

WordPress Trac noreply at wordpress.org
Tue May 17 05:19:03 UTC 2016


#36818: Export filter for post meta
------------------------------------+------------------------------
 Reporter:  justinbusa              |       Owner:
     Type:  enhancement             |      Status:  new
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Export                  |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+------------------------------

Comment (by justinbusa):

 I did some more testing on this and it looks like there are a number of
 issues that could cause serialized data to be corrupted. I haven't been
 able to pinpoint any consistent patterns, but it does seem like these can
 happen from time to time...

 1. The `WXR_Parser_Regex` class adds newlines to the import data (it also
 `rtrim`s each import line). See #32320.
 2. The `simplexml_*` functions appear to be breaking serialized data when
 passed through them. I don't have an example on hand, but I've seen this
 in my previous testing. I'm guessing that might have to do with multibyte
 characters.
 3. Mixed newline characters seem to be breaking serialized data now and
 then.
 4. PHP in general is not properly handling multibyte characters as you
 mentioned. This would explain the random weirdness that can occur.

 Given the number of ways serialized data can break on export/import, it
 seems like finding a better way to store it might be the solution. I've
 never had an issue with saving/pulling from the database, but
 export/import has been full of them.

 In my testing, base64 encoding/decoding seems to solve the issues. Do you
 think that would be something to explore for exporting/importing
 serialized data in core, or is that too far-fetched? I'm no base64 expert,
 so I don't know what the ramifications of that could be (if any).

 As for the original filter request, the importer does have a filter for
 modifying post meta before it's saved to the database, so it would be nice
 if we had one to modify it on export as well.

 Thanks again for your help on this!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36818#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list