Opened 9 years ago
Closed 9 years ago
#33259 closed defect (bug) (fixed)
Inconsistent KSES Shortcode Result
Reported by: | miqrogroove | Owned by: | miqrogroove |
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | minor | Version: | 4.2.3 |
Component: | Shortcodes | Keywords: | has-patch commit dev-reviewed |
Focuses: | Cc: |
Description
In shortcodes.php,
if ( '' !== $new_attr ) {
should be
if ( '' !== trim( $new_attr ) ) {
Otherwise we get two different results depending on how much whitespace surrounds an attribute that contained a shortcode.
Attachments (3)
Change History (16)
This ticket was mentioned in Slack in #core by obenland. View the logs.
9 years ago
#3
@
9 years ago
- Keywords needs-patch added
- Owner set to miqrogroove
- Status changed from new to assigned
#4
@
9 years ago
- Keywords has-patch added; needs-unit-tests needs-patch removed
Updated the code as per miqrogroove suggestion.
#7
in reply to:
↑ 6
@
9 years ago
Replying to obenland:
Added unit test. Not sure if that is enough though.
Not quite, but it's always good to have extra tests. I'll get this out tonight.
#9
@
9 years ago
33259.2.diff works for me.
Without the change to trim( $new_attr
) the test fails with
1) Tests_Shortcode::test_escaping with data set #2 ('1 <a noise="[test-shortcode-tag]"> 2 <a noise=" [test-shortcode-tag] " >', '1 <a noise="[test-shortcode-tag]"> 2 <a noise=" [test-shortcode-tag] " >') Failed asserting that two strings are equal. --- Expected +++ Actual @@ @@ -'1 <a noise="[test-shortcode-tag]"> 2 <a noise=" [test-shortcode-tag] " >' +'1 <a noise="[test-shortcode-tag]"> 2 <a >' /srv/www/wp-develop/svn/tests/phpunit/tests/shortcode.php:412
Note: See
TracTickets for help on using
tickets.
added patch file