Attribute value truncated when containing double quote character and using single quote delimiter
jakejackson1 opened this issue · comments
Jake Jackson commented
Guidelines
- I understand that if I fail to adhere to contribution guidelines and/or fail to provide all required details, this issue may be closed without review.
Description of the bug
It isn't possible to use double quote characters in HTML tag attributes when using single quotes as the delimiter e.g. <barcode code='{"t":1,"d":5}' type="qr"/>
. mPDF will interpret this HTML as <barcode code="{"t":1,"d":5}" type="qr"/>
and truncate code
to {
.
This bug stems from this area of code https://github.com/mpdf/mpdf/blob/development/src/Mpdf.php#L13861-L13862, which blindly converts single quotes to double quotes.
mPDF version
development
PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
any
Reproducible PHP+CSS+HTML snippet suffering by the error
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<barcode code=\'{"t":1,"d":5}\' type="qr"/>');
$mpdf->Output();