imagick icon indicating copy to clipboard operation
imagick copied to clipboard

CLI PHP crashes on shutdown after loading a larger grayscaled image on Windows

Open maryo opened this issue 4 years ago • 2 comments

Hello. I'm converting an image and although it is properly converted the script crashes PHP without any error message when PHP shuts down.

It seems it crashes only for some images regardless it's format (Tried PNG, BMP and PDF). I am running x64 PHP 7.4.15 on Windows 10 Home. I tried both TS and NTS. I even tried to compile the extension and ImageMagick myself with exactly the same result.

For example it crashes if the image is only grayscale and at least 512 px wide. If I add any other color (just a single pixel) then it's OK. It also does not crash if I run the same script through Apache.

<?php
$imagick = new Imagick(__DIR__ . '/image-crash.png'); // just this single is enough to reproduce the crash from CLI on my machine
$imagick->setImageFormat('jpg');
$imagick->writeImage(__DIR__ . '/image.jpg'); // Just to see it really is converted

obrazek

I am attaching the testing images

image-crash image-color

I have experienced this only on Windows. The same script works for me on Linux. EDIT: I've just tested the same on my laptop and it works there without the crash. I don't know what differs but my PC is fine and stable.

Let me know if I could help somehow.

maryo avatar Feb 07 '21 11:02 maryo

image

Using Version 7.4 downloaded from windows.php.net - it works flawleslly.

Are you using Laragon / Xampp or other bundled PHP versions by any chance?

seebeen avatar May 29 '21 15:05 seebeen

I've just retested it using official PHP 7.4.19 (previously I tested it using official PHP 7.4.13). Both TS versions with all extensions but imagick disabled. Still the same result - crash on shutdown. It does not happen on my second PC. I think it is somehow connected with HW (it works well on my laptop which has the same OS/Software installed) but it is stable and ImageMagick alone works well so I had to switch to calling ImageMagick using exec.

I have no experience when it comes to debugging crashing php processes. I could provide more info if I knew how to do it.

maryo avatar Jun 01 '21 20:06 maryo