From 6ac41218ccdbe43d378a997f58bf344368368bdf Mon Sep 17 00:00:00 2001 From: Sebastian Volland Date: Wed, 27 Nov 2024 23:14:29 +0100 Subject: [PATCH] Patch imagick for PHP 8.4 --- Dockerfile.template | 6 ++++++ beta/php8.4/apache/Dockerfile | 4 ++++ beta/php8.4/fpm-alpine/Dockerfile | 4 ++++ beta/php8.4/fpm/Dockerfile | 4 ++++ cli/php8.4/alpine/Dockerfile | 4 ++++ latest/php8.4/apache/Dockerfile | 4 ++++ latest/php8.4/fpm-alpine/Dockerfile | 4 ++++ latest/php8.4/fpm/Dockerfile | 4 ++++ 8 files changed, 34 insertions(+) diff --git a/Dockerfile.template b/Dockerfile.template index 017f0ed466..893694b9d9 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -95,6 +95,12 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ +{{ if env.phpVersion == "8.4" then ( -}} + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ +{{ ) else "" end -}} grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/beta/php8.4/apache/Dockerfile b/beta/php8.4/apache/Dockerfile index 699528c6a2..308daa7d17 100644 --- a/beta/php8.4/apache/Dockerfile +++ b/beta/php8.4/apache/Dockerfile @@ -53,6 +53,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/beta/php8.4/fpm-alpine/Dockerfile b/beta/php8.4/fpm-alpine/Dockerfile index f964fec144..38e8e7fb9e 100644 --- a/beta/php8.4/fpm-alpine/Dockerfile +++ b/beta/php8.4/fpm-alpine/Dockerfile @@ -54,6 +54,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/beta/php8.4/fpm/Dockerfile b/beta/php8.4/fpm/Dockerfile index 7b818f9ca2..a50615e69f 100644 --- a/beta/php8.4/fpm/Dockerfile +++ b/beta/php8.4/fpm/Dockerfile @@ -53,6 +53,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/cli/php8.4/alpine/Dockerfile b/cli/php8.4/alpine/Dockerfile index ef84f48813..5c3e9ffdc1 100644 --- a/cli/php8.4/alpine/Dockerfile +++ b/cli/php8.4/alpine/Dockerfile @@ -55,6 +55,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/latest/php8.4/apache/Dockerfile b/latest/php8.4/apache/Dockerfile index 699528c6a2..308daa7d17 100644 --- a/latest/php8.4/apache/Dockerfile +++ b/latest/php8.4/apache/Dockerfile @@ -53,6 +53,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/latest/php8.4/fpm-alpine/Dockerfile b/latest/php8.4/fpm-alpine/Dockerfile index f964fec144..38e8e7fb9e 100644 --- a/latest/php8.4/fpm-alpine/Dockerfile +++ b/latest/php8.4/fpm-alpine/Dockerfile @@ -54,6 +54,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \ diff --git a/latest/php8.4/fpm/Dockerfile b/latest/php8.4/fpm/Dockerfile index 7b818f9ca2..a50615e69f 100644 --- a/latest/php8.4/fpm/Dockerfile +++ b/latest/php8.4/fpm/Dockerfile @@ -53,6 +53,10 @@ RUN set -ex; \ curl -fL -o imagick.tgz 'https://pecl.php.net/get/imagick-3.7.0.tgz'; \ echo '5a364354109029d224bcbb2e82e15b248be9b641227f45e63425c06531792d3e *imagick.tgz' | sha256sum -c -; \ tar --extract --directory /tmp --file imagick.tgz imagick-3.7.0; \ + # Apply patch from this PR https://github.com/Imagick/imagick/pull/690 + sed -i 's/php_strtolower/zend_str_tolower/g' /tmp/imagick-3.7.0/imagick.c; \ + # Fix error "Parameter format has null default, but is not nullable" + sed -i 's/string \$format = null$/string|null \$format = null/' /tmp/imagick-3.7.0/Imagick.stub.php; \ grep '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php; \ test "$(grep -c '^//#endif$' /tmp/imagick-3.7.0/Imagick.stub.php)" = '1'; \ sed -i -e 's!^//#endif$!#endif!' /tmp/imagick-3.7.0/Imagick.stub.php; \