[wp-trac] [WordPress Trac] #57002: safecss_filter_attr() removes the trailing semincolon

WordPress Trac noreply at wordpress.org
Thu Nov 10 01:56:07 UTC 2022


#57002: safecss_filter_attr() removes the trailing semincolon
--------------------------------------+------------------------------
 Reporter:  Chouby                    |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Formatting                |     Version:  2.8.1
 Severity:  trivial                   |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  css
--------------------------------------+------------------------------

Comment (by peterwilsoncc):

 Thanks for the ticket.

 I agree that it would be nicer if `safecss_filter_attr()` retained the
 trailing semi-colon but I worry that it's a little late to change the
 function.

 If a plugin has the following code then the change would cause the style
 attribute to contain the string `;;`.

 {{{#!php

 <div
   style="<?php safecss_filter_attr( wp_unslash( $_GET[ 'user_css' ] ) );
 ?>; more:css;" />
 </div>

 }}}

 It's something browsers' error recovery should be able to handle but, as
 with the lack of trailing semi-colon, it's not very nice code.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57002#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list