[wp-trac] [WordPress Trac] #23275: WordPress Importer: line-ending mismatch corrupts serialized meta

WordPress Trac noreply at wordpress.org
Tue Jun 23 16:48:36 UTC 2015


#23275: WordPress Importer: line-ending mismatch corrupts serialized meta
--------------------------+----------------------------
 Reporter:  WraithKenny   |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  WordPress.org
Component:  Import        |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+----------------------------

Comment (by jjeaton):

 I just ran into this issue. A mismatch wasn't the problem for me, but
 having any windows line endings inside a serialized array (even without
 any other types of line endings).

 This appears to be a PHP bug first filed in 2008:
 https://bugs.php.net/bug.php?id=45573&edit=3. I'm not sure why it never
 got any attention.

 I can reproduce it here:
 [http://phpepl.cloudcontrolled.com?code=%2F%2Fthe%20original%20array%0A%24a%20%3D%20array(%0A%20%20%20%20'a23'%20%3D%3E%20'abcdefg%0Ahij'%0A)%3B%0A%2F%2Fmake%20it%20serial%0A%24s%20%3D%20serialize(%24a)%3B%0A%2F%2Fjust%20to%20see%20the%20serial%20string%0Avar_dump(%24s)%3B%0A%2F%2Fthe%20serialized%20array%0A%24s1%20%3D%20'a%3A1%3A%7Bs%3A3%3A%22a23%22%3Bs%3A11%3A%22abcdefg%0Ahij%22%3B%7D'%3B%0A%2F%2Fthe%20same%20with%20linux%20line%20end%20character%0A%24s2%20%3D%20%22a%3A1%3A%7Bs%3A3%3A%5C%22a23%5C%22%3Bs%3A11%3A%5C%22abcdefg%5C12hij%5C%22%3B%7D%22%3B%0A%2F%2Fthe%20same%20with%20windows%20line%20end%20character%2C%20same%20I%20had%20in%20my%20PEAR%20files%0A%24s3%20%3D%20%22a%3A1%3A%7Bs%3A3%3A%5C%22a23%5C%22%3Bs%3A11%3A%5C%22abcdefg%5C15%5C12hij%5C%22%3B%7D%22%3B%0A%2F%2Fturn%20it%20back%20to%20an%20array%0A%24a1%20%3D%20unserialize(%24s1)%3B%20%2F%2F%20ok%0A%24a2%20%3D%20unserialize(%24s2)%3B%20%2F%2F%20ok%0A%24a3%20%3D%20unserialize(%24s3)%3B%20%2F%2F%20not%20ok
 Test case in a PHP Repl]

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


More information about the wp-trac mailing list