Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagine is incompatible with Imagick 3.5.0 #8095

Closed
Mosnar opened this issue Jun 21, 2021 · 4 comments
Closed

Imagine is incompatible with Imagick 3.5.0 #8095

Mosnar opened this issue Jun 21, 2021 · 4 comments
Labels

Comments

@Mosnar
Copy link
Contributor

Mosnar commented Jun 21, 2021

Description

Imagick 3.5 was just released with PHP 8 support; however, it introduced a breaking change in some method signatures. Parameters are now explicitly typed and thus incompatible with the Imagine classes that are extending the \Imagick classes.

See new method signatures here:

https://github.com/Imagick/imagick/blob/6fb660ec492834a546c7cc383a29ea3ce5b5cf17/Imagick.stub.php#L472

This is particularly problematic as automated provisioning tools that aren't locked to a specific version will grab the latest release and cause an error like this in Craft:

Declaration of Imagine\Imagick\Imagick::thumbnailImage($columns, $rows, $bestfit = false, $fill = false, $filter = Imagick::FILTER_TRIANGLE, $keepImageProfiles = false, $keepExifData = false) must be compatible with Imagick::thumbnailImage(?int $columns, ?int $rows, bool $bestfit = false, bool $fill = false, bool $legacy = false): bool

Additional info

  • PHP version: 8.0.x
@brandonkelly
Copy link
Member

We just released an update to pixelandtonic/imagine which fixes this. Run composer update and you’ll get the fix.

Thanks for reporting!

@tonyclemmey
Copy link

tonyclemmey commented Jul 21, 2021

Hi @brandonkelly , I came across the same issue mentioned (using PHP 8.0.x, Imagick 3.5.0, and Craft 3.6.14)

yii\base\ErrorException: Declaration of Imagine\Imagick\Imagick::thumbnailImage($columns, $rows, $bestfit = false, $fill = false, $filter = Imagick::FILTER_TRIANGLE, $keepImageProfiles = false, $keepExifData = false) must be compatible with Imagick::thumbnailImage(?int $columns, ?int $rows, bool $bestfit = false, bool $fill = false, bool $legacy = false): bool in /var/www/vendor/pixelandtonic/imagine/src/Imagick/Imagick.php:88

I have updated Craft to the latest 3.7.4 but now get the following error when trying to upload a JPG, if I upload an MP4, PDF, PNG they will upload fine.

yii\web\BadRequestHttpException: No file was uploaded in /var/www/vendor/craftcms/cms/src/controllers/AssetsController.php:275
Stack trace:
#0 [internal function]: craft\controllers\AssetsController->actionUpload()
#1 /var/www/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#2 /var/www/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams()
#3 /var/www/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction()
#4 /var/www/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction()
#5 /var/www/vendor/craftcms/cms/src/web/Application.php(271): yii\base\Module->runAction()
#6 /var/www/vendor/craftcms/cms/src/web/Application.php(584): craft\web\Application->runAction()
#7 /var/www/vendor/craftcms/cms/src/web/Application.php(250): craft\web\Application->_processActionRequest()
#8 /var/www/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest()
#9 /var/www/web/index.php(22): yii\base\Application->run()
#10 {main}
2021-07-21 09:34:10 - info - application
$_GET = [
    'p' => 'admin/actions/assets/upload'
]

$_POST = []

$_FILES = []

Application Info

PHP version: 8.0.7
OS version: Linux 4.18.0-305.3.1.el8.x86_64
Database driver & version: PostgreSQL 13.2
Image driver & version: Imagick 3.5.0 (ImageMagick 6.9.12-15)
Craft edition & version: Craft Pro 3.7.4
Yii version: 2.0.42.1
Twig version: v2.14.6
Guzzle version: 7.3.0

@brandonkelly
Copy link
Member

@tonyclemmey Have you tried running composer update?

@tonyclemmey
Copy link

@brandonkelly not long after I ran the composer update and cleared all cookies. After that point, no error was outputted in logs but still upload for JPGs was failing. I have since reinstalled ImageMagick and uploads seem to work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants