greenrivers / grav-plugin-webp

Grav Webp plugin.
MIT License
11 stars 0 forks source link

Support for php 8.2 #9

Closed JS-Media-Creation closed 11 months ago

JS-Media-Creation commented 11 months ago

I would love to use the webp plugin, but it doesn't work for me. My suggestion is that it doesn't support php 8.2 but if you've got other suggestions, I'd love to let me know.

I'm running the latest linuxserver docker-grav image and installed the requirements with the help from here

I made the unit test and this is the output:

Unit Tests (6) -------------------------------------------------------------------------------------------------------------------------------------
E ImageTest: Get image data (0.02s)
E ImageTest: Get image data from cli (0.00s)
✔ ImageTest: Get webp path (0.00s)
✔ ImageTest: Get webp dir (0.00s)
✔ ViewTest: Get jpg image extension (0.00s)
✔ ViewTest: Get webp image extension (0.00s)
----------------------------------------------------------------------------------------------------------------------------------------------------

Time: 203 ms, Memory: 4.00 MB

There were 2 errors:

---------
1) ImageTest: Get image data
 Test  tests/unit/Helper/ImageTest.php:testGetImageData

  [ParseError] syntax error, unexpected token "match", expecting variable  

#1  /config/www/user/plugins/webp/vendor/composer/ClassLoader.php:428
#2  /config/www/user/plugins/webp/tests/unit/Helper/ImageTest.php:37
#3  /config/www/user/plugins/webp/vendor/bin/codecept:117

---------
2) ImageTest: Get image data from cli
 Test  tests/unit/Helper/ImageTest.php:testGetImageDataFromCli

  [ParseError] syntax error, unexpected token "match", expecting variable  

#1  /config/www/user/plugins/webp/vendor/composer/ClassLoader.php:428
#2  /config/www/user/plugins/webp/tests/unit/Helper/ImageTest.php:63
#3  /config/www/user/plugins/webp/vendor/bin/codecept:117

ERRORS!
Tests: 6, Assertions: 4, Errors: 2.
MajorKuprich commented 11 months ago

Hello @Schw3pps,

The issue is related with PHP EXIF package. Plugin uses functions from these package, example: exif_read_data(). You must properly configure exif extension in linuxserver/docker-grav image. You can also check config by adding below code to www/public/index.php file.

phpinfo();
exit();

Missing section in their config should looks less or more like that: exif config

Some of unit tests aren't compatible with PHP8+ due to lack of backward compatibility in Codeception 5.

This release is PHP 8+ only, so we are back on track with modern PHP. We are dropping support for PHPUnit < 9, and are technically ready for PHPUnit 10.

Regards

JS-Media-Creation commented 11 months ago

@MajorKuprich Thank you so much! Now it works as expected! :)