When printing a ticket to PDF and packaging it into a ZIP, I receive a 500 error, and the following is in the PHP error log:
[29-Jul-2025 12:25:08 UTC] PHP Fatal error: Uncaught Mpdf\MpdfException: Invalid color input, invalid color mode in binary color string in D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Color\ColorConverter.php:349
Stack trace:
#0 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Color\ColorConverter.php(75): Mpdf\Color\ColorConverter->ensureBinaryColorFormat('\x00\x00\x00\x00\x00\x00')
#1 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Mpdf.php(21087): Mpdf\Color\ColorConverter->lighten('\x00\x00\x00\x00\x00\x00')
#2 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Mpdf.php(24961): Mpdf\Mpdf->_tableRect(18.994811854812, 30.396478521479, 34.94770962371, 17.973692973693, 1, Array, false, false)
#3 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Mpdf.php(23140): Mpdf\Mpdf->printcellbuffer()
#4 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Tag\Table.php(1131): Mpdf\Mpdf->_tableWrite(Array)
#5 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Tag.php(247): Mpdf\Tag\Table->close(Array, 925)
#6 D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Mpdf.php(13718): Mpdf\Tag->CloseTag('TABLE', Array, 925)
#7 D:\wamp64\www\cis-ticket\include\class.pdf.php(49): Mpdf\Mpdf->WriteHTML(' <div>\xC2\xA0</div...', 0, true, true)
#8 D:\wamp64\www\cis-ticket\include\class.pdf.php(102): mPDFWithLocalImages->WriteHtml('<html>\n\n<head>\n...', 0, true, true)
#9 D:\wamp64\www\cis-ticket\include\class.pdf.php(79): Ticket2PDF->_print()
#10 D:\wamp64\www\cis-ticket\include\class.export.php(882): Ticket2PDF->__construct(Object(Ticket), 'Letter', '1')
#11 D:\wamp64\www\cis-ticket\include\class.export.php(970): TicketZipExporter->addTicket(Object(Ticket), Object(ZipArchive), '120763-2025', '1', 'Letter')
#12 D:\wamp64\www\cis-ticket\include\class.ticket.php(3597): TicketZipExporter->download(Array)
#13 D:\wamp64\www\cis-ticket\scp\tickets.php(547): Ticket->zipExport('1', NULL)
#14 {main}
thrown in D:\wamp64\www\cis-ticket\include\mpdf\vendor\mpdf\mpdf\src\Color\ColorConverter.php on line 349
Interestingly, this happens very rarely; 99% of the tickets can be processed normally.
From the log, it is clear to me that mPDF expects color input in the correct format but is receiving an invalid binary string. In this case, '\x00\x00\x00\x00\x00\x00'. Unfortunately, I do not know what to do to fix it.
Do you have any advice, please?
MySQL 8.0.33
PHP 8.2.7
Apache 2.4.57.3
osTicket 1.18 (724de45)