Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#3066 closed defect (bug) (duplicate)

backslash disappears in <pre>

Reported by: bzend Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.0.4
Component: General Keywords: pre, code, backslash, escape, unescape
Focuses: Cc:


Posting code on my blog, I realized that
displays as
(\n and \t are messed up, \" is not). This only occurs with the <pre> tag - <code> and <kbd> work just fine.

I tried to locate the source of the problem, and I tracked it down to wpautop (in functions-formatting.php), where in the end there is a line

$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' ", $pee);

The problem is obviously in stripslashes(clean_pre('$2')).

I did't get into the details, but I don't see why whould <pre> tags need to be cleaned at all: isn't everything between <pre> and </pre> supposed to remain untouched? - in my view, that's the whole point of <pre>!

Change History (6)

comment:1 @bzend9 years ago

  • Summary changed from backslash dissapears in <pre> to backslash disappears in <pre>

comment:2 @darkfate9 years ago

Yea, I noticed this too. +1 for taking out stripslashes.

comment:3 @johnbillion9 years ago

Removing stripslashes won't solve this. When the post is displayed on the blog the speech mark will have an additional backslash in front of it which is added by addslashes before the post is saved to the database. This needs to be removed by stripslashes at some point.

comment:4 @Nazgul8 years ago

  • Milestone set to 2.4 (future)

comment:5 @mdawaffe8 years ago

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

Duplicate of #2059.

comment:6 @foolswisdom8 years ago

  • Milestone 2.4 (next) deleted
Note: See TracTickets for help on using tickets.