WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 3 years ago

Last modified 2 years ago

#21007 closed defect (bug) (fixed)

Importing omits backslashes

Reported by: SeMeKh Owned by:
Milestone: WordPress.org Priority: normal
Severity: normal Version:
Component: Import Keywords: has-patch
Focuses: Cc:

Description

If you try to import a previously-exported post containing backslashes, those backslashes will be omitted during the import process.

Attachments (4)

importer.diff (1.5 KB) - added by SeMeKh 7 years ago.
Patch to fix the omitted-backslashes bug
21007.patch (511 bytes) - added by SergeyBiryukov 6 years ago.
21007.diff (4.9 KB) - added by boonebgorges 3 years ago.
21007.2.diff (2.0 KB) - added by ocean90 2 years ago.

Download all attachments as: .zip

Change History (15)

@SeMeKh
7 years ago

Patch to fix the omitted-backslashes bug

#1 @SeMeKh
7 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to WordPress.org

Confirmed.

#3 @SeMeKh
7 years ago

  • Keywords needs-testing added

The issue is about wordpress-import, I don't know if the same problem exists for other importers.

#4 @daveagp
6 years ago

This is basic functionality. The patch is simple and worked for me. It's a pseudo-official plugin that is linked to by core code so this is important. Please accept!

#5 @SeMeKh
6 years ago

18 months, and this isn't fixed yet. And the patch is already there!

What's wrong with Wordpress developers?

#6 @SergeyBiryukov
6 years ago

Since $postdata is a simple array, I guess we can just use array_map() here: 21007.patch.

@boonebgorges
3 years ago

#8 @boonebgorges
3 years ago

  • Resolution set to fixed
  • Status changed from new to closed

Hi all - Sorry for the delay on this. It does appear to be a bug, for terms as well as for posts. See the tests in 21007.diff.

Fixed in https://github.com/boonebgorges/wordpress-importer/commit/998f7fc75c6916355859b7e791e60b97a3efccdb. This will be part of the next minor release.

#9 @boonebgorges
3 years ago

In 38283:

Add wordpress-importer tests demonstrating slashed data behavior.

See #21007.

#10 follow-up: @mcbsys
2 years ago

Not sure whether to post here or on Github.

In 0.6.3, backslashes are still being removed from comments. I'm not familiar with WordPress code but adding another wp_slash to wordpress-importer.php seemed to fix it:

<?php

if ( isset( $inserted_comments[$comment['comment_parent']] ) )
    $comment['comment_parent'] = $inserted_comments[$comment['comment_parent']];
$comment = wp_slash( $comment );
$comment = wp_filter_comment( $comment );

@ocean90
2 years ago

#11 in reply to: ↑ 10 @ocean90
2 years ago

  • Keywords needs-testing removed

Replying to mcbsys:

Thanks for your PR. The fix will be part of the next minor version.

21007.2.diff includes a test to verify the issue and the fix.

Note: See TracTickets for help on using tickets.