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

fix: Fix compatibility with php 8.4 and newer ImageMagick library versions #704

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

michalananapps
Copy link

No description provided.

@calebdw
Copy link

calebdw commented Dec 5, 2024

@michalananapps,

Not sure if this is related to this PR or not, but I'm unable to install the latest imagick extension (with IM 6) in a PHP8.4 docker container:

#12 24.28 In /tmp/pear/temp/imagick/Imagick.stub.php:
#12 24.28 Imagick::newImage(): Parameter format has null default, but is not nullable
#12 24.29 make: *** [Makefile:191: /tmp/pear/temp/imagick/Imagick_arginfo.h] Error 1
#12 24.31 ERROR: `make INSTALL_ROOT="/tmp/pear/temp/pear-build-defaultuser8bmcdts2h2djeKWEFxQ/install-imagick-3.7.0" install' failed
#12 ERROR: process "/bin/sh -c pecl install imagick imap uv xdebug     && pecl install -o -f redis     && rm -rf /tmp/pear     && docker-php-ext-enable imagick imap redis" did not complete successfully: exit code: 1

because this is not explicitly nullable:
https://github.com/Imagick/imagick/blob/master/Imagick.stub.php#L1176

@michalananapps
Copy link
Author

Not sure if this is related to this PR or not, but I'm unable to install the latest imagick extension (with IM 6) in a PHP8.4 docker container:

This PR is one of the fixes for compatibility with PHP 8.4, but it is not directly related to your issue. Your issue is related to the Imagick.stub.php file, which was fixed in the develop branch six months ago but has not yet been included in an official release. You are currently using the PECL official release, where this fix is not available yet. Commit with the fix: Commit Link.

You can install any development version of Imagick using mlocati/php-extension-installer. For example:

COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/  
RUN install-php-extensions https://api.github.com/repos/michalananapps/imagick/tarball/cd0bc8f4269ee3845b2cc216f5555dc2a676712b  

This command will install the version from the specified commit. However, you must ensure that you only install it from trusted sources. The example above uses the current commit of this PR's source branch. Use it at your own risk. 😊

@calebdw
Copy link

calebdw commented Dec 5, 2024

Awesome, thanks for the info---I didn't know this tool existed!

It looks like PHP 8.4 support for imagick is built into the tool so you can just use:

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN install-php-extensions imagick

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

Successfully merging this pull request may close these issues.

2 participants