dolibarr/htdocs/includes/mike42
w3houde e3ef54b4a9
Fix #34969 accept GdImage objects in vendored Mike42 GdEscposImage on PHP 8 (#38793)
* Fix #34969 accept GdImage objects in vendored Mike42 GdEscposImage on PHP 8

PHP 8.0+ returns GdImage objects from imagecreate*/imagecreatefromgd2, where
older PHP returned resources. The vendored Mike42 escpos library guards with
is_resource($im) only (htdocs/includes/mike42/escpos-php/src/Mike42/Escpos/GdEscposImage.php:61),
so any ESC/POS receipt that contains an image throws 'Failed to load image'
on PHP 8 even though the GD handle is valid.

Accept '$im instanceof \\GdImage' next to is_resource() so the same code path
keeps working on PHP 7 and PHP 8. Upstream Mike42 has not been updated; this
is the same minimal patch reporters maintain locally.

Signed-off-by: Dolicraft <contact@dolicraft.com>

* Fix #34969 follow-up: track Mike42 escpos GdImage patch in dolibarr_changes.txt

Signed-off-by: Dolicraft <contact@dolicraft.com>

* Fix #34969 trigger CI re-run (previous phpstan job aborted with infra exit 2)

Signed-off-by: Dolicraft <contact@dolicraft.com>

* Fix #34969 retrigger CI (previous phpstan job aborted: No files found)

Signed-off-by: Dolicraft <contact@dolicraft.com>

---------

Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2026-07-09 11:49:33 +02:00
..
escpos-php Clean files 2026-05-20 19:10:31 +02:00