Opened 9 years ago
Last modified 5 years ago
#32320 new defect (bug)
WordPress Importer: WXR_Parser_Regex adds newlines to import data, breaking serialized post meta.
Reported by: | justinbusa | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Import | Keywords: | |
Focuses: | administration | Cc: |
Description
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.
Patch without rtrim() and the newline.