From 756bdbf92f82a6466b5b264ca4ab382aef46e8ac Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sun, 3 Nov 2024 13:56:36 +0800 Subject: [PATCH] Fix imagick build for PHP 8.4 --- src/SPC/store/SourcePatcher.php | 10 +++++++ src/globals/patch/imagick_php84.patch | 40 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/globals/patch/imagick_php84.patch diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index f74b1d84..c97ccf8d 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -26,6 +26,7 @@ class SourcePatcher FileSystem::addSourceExtractHook('yaml', [SourcePatcher::class, 'patchYamlWin32']); FileSystem::addSourceExtractHook('libyaml', [SourcePatcher::class, 'patchLibYaml']); FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchImapLicense']); + FileSystem::addSourceExtractHook('ext-imagick', [SourcePatcher::class, 'patchImagickWith84']); } /** @@ -383,6 +384,15 @@ class SourcePatcher return false; } + /** + * Patch imagick for PHP 8.4 + */ + public static function patchImagickWith84(): bool + { + SourcePatcher::patchFile('imagick_php84.patch', SOURCE_PATH . '/php-src/ext/imagick'); + return true; + } + /** * Patch cli SAPI Makefile for Windows. * diff --git a/src/globals/patch/imagick_php84.patch b/src/globals/patch/imagick_php84.patch new file mode 100644 index 00000000..8eb98bb1 --- /dev/null +++ b/src/globals/patch/imagick_php84.patch @@ -0,0 +1,40 @@ +From 65e27f2bc02e7e8f1bf64e26e359e42a1331fca1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= +Date: Wed, 25 Sep 2024 10:56:28 +0200 +Subject: [PATCH] Fix removed "php_strtolower" for PHP 8.4 + +--- + imagick.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/imagick.c b/imagick.c +index 1b765389..ebab7ae7 100644 +--- a/imagick.c ++++ b/imagick.c +@@ -610,7 +610,7 @@ static zval *php_imagick_read_property(zend_object *object, zend_string *member, + if (format) { + retval = rv; + ZVAL_STRING(retval, format); +- php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); ++ zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + retval = rv; +@@ -683,7 +683,7 @@ static zval *php_imagick_read_property(zval *object, zval *member, int type, voi + if (format) { + retval = rv; + ZVAL_STRING(retval, format); +- php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); ++ zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + retval = rv; +@@ -766,7 +766,7 @@ static zval *php_imagick_read_property(zval *object, zval *member, int type, con + + if (format) { + ZVAL_STRING(retval, format, 1); +- php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); ++ zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval)); + IMAGICK_FREE_MAGICK_MEMORY(format); + } else { + ZVAL_STRING(retval, "", 1); \ No newline at end of file