[wp-trac] Re: [WordPress Trac] #4409: KSES removes text after a non-tag less than sign

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 15 16:21:08 GMT 2007


#4409: KSES removes text after a non-tag less than sign
----------------------+-----------------------------------------------------
 Reporter:  mdawaffe  |        Owner:  anonymous  
     Type:  defect    |       Status:  new        
 Priority:  high      |    Milestone:  2.3 (trunk)
Component:  General   |      Version:  2.2        
 Severity:  critical  |   Resolution:             
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by AmbushCommander):

 Hi, this is the lead developer for HTML Purifier. The upcoming, newest
 version of HTML Purifier does in fact handle this case gracefully by
 changing the unescaped < into a literal. For your case, however, with one
 simple regex:

 $html = preg_replace('/<([^A-Za-z0-9])/', '&lt;$1', $html);

 No mucking around kses necessary. This, however, will turn < br> into &lt;
 br&gt;

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4409#comment:7>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list