[wp-trac] [WordPress Trac] #61719: WP_HTML_Tag_Processor doesn't allow to set a valid image src
WordPress Trac
noreply at wordpress.org
Mon Jul 22 02:34:41 UTC 2024
#61719: WP_HTML_Tag_Processor doesn't allow to set a valid image src
--------------------------+-----------------------------
Reporter: ivanzhuck | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.6
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
WP_HTML_Tag_Processor doesn't allow to set inline encoded SVG as a source
for IMG tag. It appeared in WordPress version 6.6
How to reproduce:
{{{#!php
$newSrc = "data:image/svg+xml,%0A%3Csvg width='100' height='100'
viewBox='0 0 100 100' fill='none'
xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100' height='100'
fill='%23D9D9D9'/%3E%3C/svg%3E%0A";
$processor = new WP_HTML_Tag_Processor( '<img src="something">' );
$processor->next_tag('IMG');
$processor->set_attribute('src', $newSrc);
$outputHtml = $processor->get_updated_html();
// $outputHtml contains <img src=""> instead of <img
src="data:image/svg+xml...">
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61719>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list