[wp-trac] [WordPress Trac] #32320: WordPress Importer: WXR_Parser_Regex adds newlines to import data, breaking serialized post meta.

WordPress Trac noreply at wordpress.org
Sat May 9 08:17:54 UTC 2015


#32320: WordPress Importer: WXR_Parser_Regex adds newlines to import data, breaking
serialized post meta.
----------------------------+-----------------------------
 Reporter:  justinbusa      |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Import          |    Version:
 Severity:  normal          |   Keywords:
  Focuses:  administration  |
----------------------------+-----------------------------
 Original ticket: [https://plugins.trac.wordpress.org/ticket/2317]

 Our plugin stores a fair amount of serialized data in post meta fields.
 When using the importer, the WXR_Parser_Regex parser loops through 8192
 bytes of the import file at a time, appending a newline to the import data
 at the end of each loop. When a newline is inserted in the middle of our
 post meta, it breaks when the time comes to unserialize in the import
 process, leaving our users with a blank post meta field.

 The offending code can be seen starting at line 459 of parsers.php...

 {{{
 if ( $in_post ) {
         $post .= $importline . "\n";
 }
 }}}

 Is that newline necessary? I have verified that removing it solves the
 problem and imports the serialized data correctly.

 @duck_ has suggested removing rtrim() and the new line which I will submit
 as a patch.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32320>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list