#20369 closed defect (bug) (fixed)
HTML captions: Using double quotes for attributes breaks the ouput
Reported by: | ocean90 | Owned by: | azaozz |
---|---|---|---|
Milestone: | 3.4 | Priority: | normal |
Severity: | normal | Version: | 3.4 |
Component: | Shortcodes | Keywords: | has-patch |
Focuses: | Cc: |
Description
Input:
<a href="http://google.de>Google</a> <span class="foo">Bar</span>
HTML editor output:
<a hrefArray>Google</a> <span classArray>Bar</span>
Visual editor output:
<a>Google</a> <span>Bar</span>
Confirmed by sabreuse too.
Related: #18311
Attachments (3)
Change History (16)
#2
@
13 years ago
- Component changed from Editor to Shortcodes
- Keywords close added; needs-patch removed
#3
in reply to:
↑ 1
@
13 years ago
- Keywords needs-patch added; close removed
Replying to azaozz:
Yes, when typing the caption shortcode by hand in the HTML editor (did you really do that?) care should be taken to use the right quotes.
No, I'm talking about the image properties popup.
oh. buggy. When I added a caption at the time I first uploaded the image, it stripped the href attribute - so I got bare <a> tags, but not >the hrefArray you're seeing. When I inserted a caption on an image that was already in the post (i.e. with the edit button that appears on >rollover in the editor), the link worked fine.
#4
@
13 years ago
- Keywords has-patch added; needs-patch removed
There's also a notice:
Notice: Array to string conversion in includes/media.php on line 173
20369.patch seems to fix the issue.
#5
@
13 years ago
I see, since the second callback fails, it never gets to the bits that replace double with single quotes.
#6
follow-up:
↓ 10
@
13 years ago
- Owner set to azaozz
- Resolution set to fixed
- Status changed from new to closed
In [20376]:
#7
@
13 years ago
There's also a tab where a space should be instead (20369.minor-typo-fix.patch).
#10
in reply to:
↑ 6
;
follow-up:
↓ 11
@
13 years ago
Replying to azaozz:
In [20376]:
That code can be simplified to remove the isset() check. The function will not be called unless there was a match which means that key 0 will be set.
See 20369.simplify.diff. I also changed the parameter to $matches
since it's not actually a string.
Yes, when typing the caption shortcode by hand in the HTML editor (did you really do that?) care should be taken to use the right quotes.
Things like
[shortcode arg="<tag attr="1">"]
would of course break it same as any other string in PHP, JS, etc.This is the only case where that could happen, in all other cases quotes are automatically converted to the proper format. Also when the shortcode is inserted from the media library popup (regardless of which editor is used), the quotes are in the right format (converted when needed).