[wp-trac] [WordPress Trac] #3066: backslash dissapears in <pre>

WordPress Trac wp-trac at lists.automattic.com
Thu Aug 24 05:08:12 GMT 2006


#3066: backslash dissapears in <pre>
---------------------+------------------------------------------------------
 Reporter:  bzend    |       Owner:  anonymous                             
     Type:  defect   |      Status:  new                                   
 Priority:  normal   |   Milestone:                                        
Component:  General  |     Version:  2.0.4                                 
 Severity:  normal   |    Keywords:  pre, code, backslash, escape, unescape
---------------------+------------------------------------------------------
 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>!

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3066>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list