[wp-trac] [WordPress Trac] #36306: Smiley in shortcode attribute breaks the parsing
WordPress Trac
noreply at wordpress.org
Wed Mar 23 11:49:15 UTC 2016
#36306: Smiley in shortcode attribute breaks the parsing
--------------------------+-----------------------------
Reporter: Unyson | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Emoji | Version: 4.4.2
Severity: normal | Keywords:
Focuses: template |
--------------------------+-----------------------------
== The Problem ==
When using smiley in shortcode attrbibutes it breaks the parsing, because
smiley are transformed to html too early, before the attribute parsing
begins, so do_shortcode receives
{{{
[footag foo="Hello <img src="..."> World"]
}}}
'''Steps to reproduce''':
1. Create the a test shortcode
{{{#!php
<?php
function footag_func( $atts ) {
return "foo = {$atts['foo']}";
}
add_shortcode( 'footag', 'footag_func' );
}}}
2. Add in post content:
{{{
[footag foo="Hello World"]
}}}
Save the post and check the frontend - '''Works'''
3. Edit post content:
{{{
[footag foo="Hello :-) World"]
}}}
Save the post and check the frontend - '''Notice: Undefined index: foo'''
== The Fix ==
Replace [https://github.com/WordPress/WordPress/blob/4.4.2/wp-includes
/default-filters.php#L133 this line] with
{{{#!php
<?php
add_filter( 'the_content', 'convert_smilies', 12 ); // after
do_shortcode()
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36306>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list