Opened 11 years ago
Closed 11 years ago
#33259 closed defect (bug) (fixed)
Inconsistent KSES Shortcode Result
| Reported by: | miqrogroove | Owned by: | miqrogroove |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.3 |
| Component: | Shortcodes | Version: | 4.2.3 |
| Severity: | minor | Keywords: | has-patch commit dev-reviewed |
| Cc: | Focuses: |
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.
11 years ago
#4
@
11 years ago
- Keywords has-patch added; needs-unit-tests needs-patch removed
Updated the code as per miqrogroove suggestion.
#7
in reply to: ↑ 6
@
11 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
@
11 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
#12
@
11 years ago
trim() strips null bytes too. Should be perfect.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
added patch file