Ticket #3066 (closed defect: duplicate)

Opened 2 years ago

Last modified 9 months ago

backslash disappears in <pre>

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

Description

Posting code on my blog, I realized that <pre>\n\t\"</pre> displays as <pre>nt\"<pre> (\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

08/25/06 06:00:49 changed by bzend

  • summary changed from backslash dissapears in <pre> to backslash disappears in <pre>.

08/26/06 13:43:27 changed by darkfate

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

03/14/07 05:04:51 changed by johnbillion

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.

07/15/07 18:13:11 changed by Nazgul

  • milestone set to 2.4 (future).

08/31/07 16:34:24 changed by mdawaffe

  • status changed from new to closed.
  • resolution set to duplicate.

Duplicate of #2059.

08/31/07 19:12:36 changed by foolswisdom

  • milestone deleted.