PrestaShop / docker

🐳
https://hub.docker.com/r/prestashop/prestashop/
MIT License
257 stars 176 forks source link

Fix configuration of gd in base images below PHP 7.4 #380

Closed Quetzacoalt91 closed 3 months ago

Quetzacoalt91 commented 3 months ago
Questions Answers
Description? When running versions of PrestaShop with old base images, imagecreatefromjpeg() is undefined. This is caused by a change we applied on all images about GD, which actually only valid from PHP 7.4. Although it never failed, the gd extension was not loaded on previous versions.
Type? bug fix
BC breaks? Nope
Deprecations? Nope
Fixed ticket? Unblocks https://github.com/PrestaShop/autoupgrade/pull/688
Sponsor company /
How to test? Look below

How to test

imagecreatefromjpeg();


* If you build from the master branch this error will be reported: `PHP Fatal error:  Uncaught Error: Call to undefined function imagecreatefromjpeg() in -:3`
* From this PR, you get another error because I didn't send any parameters, but at least the function now exists: `PHP Warning:  imagecreatefromjpeg() expects exactly 1 parameter, 0 given in - on line 3`

## Reported errors:

```prestashop_autoupgrade  | [Thu Apr 11 16:50:41.395837 2024] [php7:error] [pid 65] [client 192.168.0.1:42770] PHP Fatal error:  Uncaught Error: Call to undefined function imagecreatefromjpeg() in /var/www/html/classes/ImageManager.php:533\nStack trace:\n#0 /var/www/html/classes/ImageManager.php(260): ImageManagerCore::create(2, '/var/www/html/i...')\n#1 /var/www/html/src/Adapter/Image/ImageRetriever.php(151): ImageManagerCore::resize('/var/www/html/i...', '/var/www/html/i...', 800, 800)\n#2 /var/www/html/src/Adapter/Image/ImageRetriever.php(80): PrestaShop\\PrestaShop\\Adapter\\Image\\ImageRetriever->getImage(Object(Product), '1')\n#3 [internal function]: PrestaShop\\PrestaShop\\Adapter\\Image\\ImageRetriever->PrestaShop\\PrestaShop\\Adapter\\Image\\{closure}(Array)\n#4 /var/www/html/src/Adapter/Image/ImageRetriever.php(90): array_map(Object(Closure), Array)\n#5 /var/www/html/src/Core/Product/ProductPresenter.php(95): PrestaShop\\PrestaShop\\Adapter\\Image\\ImageRetriever->getProductImages(Array, Object(Language))\n#6 /var/www/html/src/Core/Product/ProductPresenter.php(563): PrestaShop\\PrestaShop\\Core\\Product\\ProductPresenter->fillImages(Array, Object(Presta in /var/www/html/classes/ImageManager.php on line 533```