Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #45067, comment 13


Ignore:
Timestamp:
10/17/2018 08:26:55 AM (6 years ago)
Author:
azaozz
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #45067, comment 13

    initial v1  
    66The first thing `do_shortcode_tag()` (from `preg_replace_callback( "/$pattern/", 'do_shortcode_tag', $attr, -1, $count );`) does is to check if the shortcode was "escaped" by using `[[` and `]]`. If it is, it strips the extra `[` and `]` and returns the remaining shortcode without executing the callback for it. Then the shortcode output is additionally filtered with `wp_kses_one_attr( $new_attr, $elname );`.
    77
    8 The failing test is for escaped shortcode `[[gallery]]`, so the expected behavior is to get `[gallery]` back. That's what happens, however until now the whole `background:url([gallery])` was stripped by `safecss_filter_attr()`, and because of
     8The failing test is for escaped shortcode `[[gallery]]`, so the expected behavior is to get `[gallery]` back. That's what happens, however until now the whole `background:url([gallery])` was stripped by `safecss_filter_attr()`, i.e. `$new_attr` was an empty string, and because of
    99{{{
    1010if ( '' !== trim( $new_attr ) ) {
     
    1414}}}
    1515
    16 the `$attr` remained unchanged (it's safe as it already has passed through kses when saving) and no shortcode is "executed".
     16the `$attr` remained unchanged (it's safe as it has already passed through kses when saving) and no shortcode is "executed".
    1717
    18 After the patch here we keep `background:url(*)` which is replaced in the above code and shows as test error when in fact is the proper output.
    19 
     18After the patch here we keep `background:url(*)` CSS values, so `$new_attr` is not empty any more. So `$attr` gets set to `$new_attr` in the above code, and shows as test error when in fact is the proper output.