Make WordPress Core

Opened 13 years ago

Last modified 6 years ago

#19764 new defect (bug)

Invalid JSON in custom fields meta value after export

Reported by: abdessamad-idrissi's profile abdessamad idrissi Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.3
Component: Import Keywords: needs-patch
Focuses: Cc:

Description

Hey there,

I exported a working copy of my online WordPress site to a local copy and noticed that the code gets changed; The backslash is removed which causes the json format to be invalide.
Original code in the custom fields meta

{"videos":{"0":"<iframe width=\"480\" height=\"360\" src=\"http://www.youtube.com/embed/YAozOaxXYx4\" frameborder=\"0\" allowfullscreen></iframe>"}}

Becomes in the local site after import

{"videos":{"0":"<iframe width="480" height="360" src="http://www.youtube.com/embed/YAozOaxXYx4" frameborder="0" allowfullscreen></iframe>"}}

Change History (6)

#1 @duck_
13 years ago

This is probably caused by stripslashes_deep($meta_value) in add_metadata().

#2 follow-up: @abdessamad idrissi
13 years ago

I think it has to do with the WordPress import utility because when I check the exported XML file I find the backslashes there.

#3 in reply to: ↑ 2 @duck_
13 years ago

  • Component changed from Export to Import
  • Version 3.3.1 deleted

Replying to abdessamad idrissi:

I think it has to do with the WordPress import utility because when I check the exported XML file I find the backslashes there.

Yep. The importer uses add_post_meta() which calls add_metadata() which strips slashes from the value.

#4 @coffee2code
13 years ago

  • Keywords needs-patch added
  • Version set to 3.3.1

#5 @SergeyBiryukov
12 years ago

  • Milestone changed from Awaiting Review to WordPress.org

#6 @chriscct7
9 years ago

  • Version changed from 3.3.1 to 3.3
Note: See TracTickets for help on using tickets.