Skip to content

Set offset when parsing CSS for data URIs#3673

Merged
bsweeney merged 1 commit intomasterfrom
data-uri-handling
Oct 28, 2025
Merged

Set offset when parsing CSS for data URIs#3673
bsweeney merged 1 commit intomasterfrom
data-uri-handling

Conversation

@bsweeney
Copy link
Copy Markdown
Member

fixes #3672

@bsweeney bsweeney added this to the 3.1.4 milestone Oct 19, 2025
@bsweeney bsweeney merged commit ee93178 into master Oct 28, 2025
35 checks passed
@bsweeney bsweeney deleted the data-uri-handling branch October 28, 2025 11:10
@dkjalindu-prog
Copy link
Copy Markdown

composer require dompdf/dompdf

@Cruiser13
Copy link
Copy Markdown

Cruiser13 commented Jan 21, 2026

@bsweeney this seems to be incomplete. The following works fine on dompdf 3.1.0:

<div style="background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg')">Test</div>

But it does no longer work on 3.1.3 and 3.1.4.

@bsweeney
Copy link
Copy Markdown
Member Author

@Cruiser13 that specific sample rendered OK for me on 3.1.4.

This change addresses an issue parsing data URIs that are part of a stylesheet. Which is maybe where you're encountering an issue? For example, the following does not work in 3.1.4:

<style>
    .bg { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg'); }
</style>
<div class="bg">Test</div>

I've already produced a fix in relation to #3706 and plan to push a new release in the near future. You can work around that issue by using double quote instead of single quotes

@Cruiser13
Copy link
Copy Markdown

Thanks, it indeed happens on explicit style and not on the element itself. Thank you for the reference to the issue and sorry to bother you!

@bsweeney
Copy link
Copy Markdown
Member Author

No worries! Glad to know this was not a different issue than the one identified recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hanging/Infinite loop bug in Stylesheet::_parse_css

3 participants