Imagepng(): gd-png: fatal libpng error: zlib failed to initialize compressor

Hi,

I am getting a very obscure error with laminas captcha after upgrading to PHP 7.4.
The issue only occurs on the production server.

The Laminas captcha library doesn’t produce a valid png image and I see these errors in the logs:

PHP Warning: imagepng(): gd-png: fatal libpng error: zlib failed to initialize compressor – stream error in /vendor/laminas/laminas-captcha/src/Image.php on line 613

PHP Warning: imagepng(): gd-png error: setjmp returns error condition in vendor/laminas/laminas-captcha/src/Image.php on line 613

Has anyone ever seen this before or know where I should even start to troubleshoot?

Related? https://bugs.php.net/bug.php?id=75778

Thanks for responding.
I don’t think it is related as it seems too old.
The issue also affected laminas-barcode

This issue was resolved by upgrading PHP from 7.4.22 to 7.4.28.

There are a couple of GD extension issues between these versions, I am going with this one: PHP :: Bug #71316 :: libpng warning from imagecreatefromstring, purely because it involves the format of the png image, but I am only guessing.