Intervention / image

PHP Image Processing
https://image.intervention.io
MIT License
13.79k stars 1.5k forks source link

Silence php warning when throwing decoder exceptions #1353

Closed VincentLanglet closed 1 month ago

VincentLanglet commented 1 month ago

Hi @olivervogel,

I'm getting multiple warnings:

Warning: imagecreatefromjpeg(): gd-jpeg error: cannot allocate gdImage struct

or similar message when decoding bad inputs.

Since parent::decode call is already throwing an exception

throw new DecoderException('Unable to decode input')

there is no need to keep such warning which cannot be easily silenced.

olivervogel commented 1 month ago

Yeah, that sounds good. I think this can be merged as is. Although I wonder why the checks fail since you haven't changed anything in the files mentioned.

VincentLanglet commented 1 month ago

Yeah, that sounds good. I think this can be merged as is. Although I wonder why the checks fail since you haven't changed anything in the files mentioned.

Maybe phpstan improved his checks and detects more error now ?

Do you want me to fix them ?

olivervogel commented 1 month ago

Do you want me to fix them ?

Would be great if you could take a look.

VincentLanglet commented 1 month ago

Fixed @olivervogel

olivervogel commented 1 month ago

Thanks alot.