diff options
Diffstat (limited to 'imagick-php81.patch')
-rw-r--r-- | imagick-php81.patch | 287 |
1 files changed, 0 insertions, 287 deletions
diff --git a/imagick-php81.patch b/imagick-php81.patch deleted file mode 100644 index 8a799fe..0000000 --- a/imagick-php81.patch +++ /dev/null @@ -1,287 +0,0 @@ -From 81cc92ec24549c86be875b1a9977419a76f3471d Mon Sep 17 00:00:00 2001 -From: Danack <Danack@basereality.com> -Date: Sat, 5 Jun 2021 15:25:05 +0100 -Subject: [PATCH] Add ifdef for PHP 8.1 - ---- - imagick.c | 2 +- - php_imagick_defs.h | 5 +++++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/imagick.c b/imagick.c -index f7a94ae0..d2cf9fef 100644 ---- a/imagick.c -+++ b/imagick.c -@@ -3829,7 +3829,7 @@ PHP_MINIT_FUNCTION(imagick) - #endif - - php_imagick_sc_entry = zend_register_internal_class(&ce TSRMLS_CC); -- zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 2, zend_ce_iterator, spl_ce_Countable); -+ zend_class_implements(php_imagick_sc_entry TSRMLS_CC, 2, zend_ce_iterator, im_ce_countable); - - /* - Initialize the class (ImagickDraw) -diff --git a/php_imagick_defs.h b/php_imagick_defs.h -index 859f35df..6017b33c 100644 ---- a/php_imagick_defs.h -+++ b/php_imagick_defs.h -@@ -79,6 +79,11 @@ - #define im_long long - #endif - -+#if PHP_VERSION_ID >= 80100 -+ #define im_ce_countable zend_ce_countable -+#else -+ #define im_ce_countable spl_ce_Countable -+#endif - - typedef struct _php_imagick_callback { - void ***thread_ctx; -From 9a48afcca65beed794dee3da15eef9c077eba487 Mon Sep 17 00:00:00 2001 -From: Danack <Danack@basereality.com> -Date: Sat, 5 Jun 2021 15:43:03 +0100 -Subject: [PATCH] Explicit casts to make php 8.1 happy. - ---- - tests/244_Tutorial_psychedelicFontGif_basic.phpt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/244_Tutorial_psychedelicFontGif_basic.phpt b/tests/244_Tutorial_psychedelicFontGif_basic.phpt -index 3fde1d74..a1bd1d98 100644 ---- a/tests/244_Tutorial_psychedelicFontGif_basic.phpt -+++ b/tests/244_Tutorial_psychedelicFontGif_basic.phpt -@@ -34,7 +34,7 @@ function psychedelicFontGif($name = 'Danack') { - $draw->setStrokeColor($color); - $draw->setFillColor($color); - $draw->setStrokeWidth($strokeWidth * 3 * $scale); -- $draw->annotation(60 * $scale, 165 * $scale, $name); -+ $draw->annotation((int)(60 * $scale), (int)(165 * $scale), $name); - } - - $draw->setStrokeColor('none'); -@@ -44,7 +44,7 @@ function psychedelicFontGif($name = 'Danack') { - - //Create an image object which the draw commands can be rendered into - $imagick = new \Imagick(); -- $imagick->newImage(650 * $scale, 230 * $scale, "#eee"); -+ $imagick->newImage((int)(650 * $scale), (int)(230 * $scale), "#eee"); - $imagick->setImageFormat("png"); - - //Render the draw commands in the ImagickDraw object -From a6ff2498e3f4cd1f9a200d5695dfddba458a9064 Mon Sep 17 00:00:00 2001 -From: Danack <Danack@basereality.com> -Date: Sat, 5 Jun 2021 15:44:17 +0100 -Subject: [PATCH] Explicit casts to make php 8.1 happy. - ---- - tests/245_Tutorial_screenEmbed_basic.phpt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tests/245_Tutorial_screenEmbed_basic.phpt b/tests/245_Tutorial_screenEmbed_basic.phpt -index e25229da..36b9fbcf 100644 ---- a/tests/245_Tutorial_screenEmbed_basic.phpt -+++ b/tests/245_Tutorial_screenEmbed_basic.phpt -@@ -33,7 +33,7 @@ function screenEmbed() { - $overlay->modulateImage(97, 100, 0); - $overlay->distortImage(\Imagick::DISTORTION_PERSPECTIVE, $points, true); - -- $imagick->compositeImage($overlay, \Imagick::COMPOSITE_OVER, 364.5 - $offset, 23.5); -+ $imagick->compositeImage($overlay, \Imagick::COMPOSITE_OVER, (int)(364.5 - $offset), 23); - - $bytes = $imagick->getImageBlob(); - if (strlen($bytes) <= 0) { echo "Failed to generate image.";} -From 8d550128a271b2d6659e81b023e25b2ed0b787fa Mon Sep 17 00:00:00 2001 -From: Danack <Danack@basereality.com> -Date: Sat, 5 Jun 2021 15:46:21 +0100 -Subject: [PATCH] Explicit casts to make php 8.1 happy. - ---- - tests/049_Imagick_deskewImage_basic.phpt | 7 ++++++- - tests/110_Imagick_resizeImage_basic.phpt | 4 ++-- - 2 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/tests/049_Imagick_deskewImage_basic.phpt b/tests/049_Imagick_deskewImage_basic.phpt -index 96364c2b..0ec546f2 100644 ---- a/tests/049_Imagick_deskewImage_basic.phpt -+++ b/tests/049_Imagick_deskewImage_basic.phpt -@@ -26,7 +26,12 @@ function deskewImage($threshold) { - $deskewImagick->cropImage($deskewImagick->getImageWidth() - $trim, $deskewImagick->getImageHeight(), $trim, 0); - $imagick->cropImage($imagick->getImageWidth() - $trim, $imagick->getImageHeight(), $trim, 0); - $deskewImagick->resizeimage($deskewImagick->getImageWidth() / 2, $deskewImagick->getImageHeight() / 2, \Imagick::FILTER_LANCZOS, 1); -- $imagick->resizeimage($imagick->getImageWidth() / 2, $imagick->getImageHeight() / 2, \Imagick::FILTER_LANCZOS, 1); -+ $imagick->resizeimage( -+ (int)($imagick->getImageWidth() / 2), -+ (int)($imagick->getImageHeight() / 2), -+ \Imagick::FILTER_LANCZOS, -+ 1 -+ ); - $newCanvas = new \Imagick(); - $newCanvas->newimage($imagick->getImageWidth() + $deskewImagick->getImageWidth() + 20, $imagick->getImageHeight(), 'red', 'jpg'); - $newCanvas->compositeimage($imagick, \Imagick::COMPOSITE_COPY, 5, 0); -diff --git a/tests/110_Imagick_resizeImage_basic.phpt b/tests/110_Imagick_resizeImage_basic.phpt -index c800e5fa..0628afb4 100644 ---- a/tests/110_Imagick_resizeImage_basic.phpt -+++ b/tests/110_Imagick_resizeImage_basic.phpt -@@ -32,8 +32,8 @@ function resizeImage($width, $height, $filterType, $blur, $bestFit, $cropZoom) { - $imagick->cropimage( - $newWidth, - $newHeight, -- ($cropWidth - $newWidth) / 2, -- ($cropHeight - $newHeight) / 2 -+ (int)(($cropWidth - $newWidth) / 2), -+ (int)(($cropHeight - $newHeight) / 2) - ); - - $imagick->scaleimage( -From c7578c71285fb11d129abb7b9781c91db91f93da Mon Sep 17 00:00:00 2001 -From: Danack <Danack@basereality.com> -Date: Sat, 5 Jun 2021 19:23:29 +0100 -Subject: [PATCH] Fix parsing of nullable long parameters. - ---- - imagick_class.c | 15 +++++++++++++-- - runTests.sh | 7 +++++-- - 2 files changed, 18 insertions(+), 4 deletions(-) - -diff --git a/imagick_class.c b/imagick_class.c -index 23e42de0..9a390f2b 100644 ---- a/imagick_class.c -+++ b/imagick_class.c -@@ -7855,13 +7855,24 @@ zend_bool s_resize_bounding_box(MagickWand *magick_wand, im_long box_width, im_l - */ - PHP_METHOD(imagick, thumbnailimage) - { -- im_long width, height, new_width, new_height; -+ im_long width = 0, height = 0, new_width, new_height; - php_imagick_object *intern; - zend_bool bestfit = 0, fill = 0; - zend_bool legacy = 0; - -+ // Changing longs to be nullable "l!", means that zpp -+ // wants to write whether they were null to a variable. -+ bool width_is_null = 1; -+ bool height_is_null = 1; -+ -+ - /* Parse parameters given to function */ -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|bbb", &width, &height, &bestfit, &fill, &legacy) == FAILURE) { -+ if (zend_parse_parameters( -+ ZEND_NUM_ARGS() TSRMLS_CC, -+ "l!l!|bbb", -+ &width, &width_is_null, -+ &height, &height_is_null, -+ &bestfit, &fill, &legacy) == FAILURE) { - return; - } - - -From 212de567ef514e2a07f0c55502fe7ceb66ece6a7 Mon Sep 17 00:00:00 2001 -From: Danack <Danack@basereality.com> -Date: Sat, 5 Jun 2021 19:46:41 +0100 -Subject: [PATCH] Wrap param parsing to use old method, until versions that - don't require a compiler that understands bools are dropped. - ---- - imagick_class.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/imagick_class.c b/imagick_class.c -index 9a390f2b..2f9e6909 100644 ---- a/imagick_class.c -+++ b/imagick_class.c -@@ -7860,11 +7860,16 @@ PHP_METHOD(Imagick, thumbnailImage) - zend_bool bestfit = 0, fill = 0; - zend_bool legacy = 0; - -+#if PHP_VERSION_ID < 80100 -+ // This uses an implicit conversion of null to 0 for longs -+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll|bbb", &width, &height, &bestfit, &fill, &legacy) == FAILURE) { -+ return; -+ } -+#else - // Changing longs to be nullable "l!", means that zpp - // wants to write whether they were null to a variable. -- bool width_is_null = 1; -- bool height_is_null = 1; -- -+ bool width_is_null = 0; -+ bool height_is_null = 0; - - /* Parse parameters given to function */ - if (zend_parse_parameters( -@@ -7875,6 +7880,7 @@ PHP_METHOD(Imagick, thumbnailImage) - &bestfit, &fill, &legacy) == FAILURE) { - return; - } -+#endif - - intern = Z_IMAGICK_P(getThis()); - if (php_imagick_ensure_not_empty (intern->magick_wand) == 0) -From 78c9daa8bfc56aa5806b062ee5605f57e81f063e Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Wed, 9 Jun 2021 09:39:25 +0200 -Subject: [PATCH 1/2] get rid of ZVAL_NEW_ARR - ---- - imagick_class.c | 4 +--- - 1 file changed, 1 insertion(+), 3 deletions(-) - -diff --git a/imagick_class.c b/imagick_class.c -index e041f4e..2254313 100644 ---- a/imagick_class.c -+++ b/imagick_class.c -@@ -6841,7 +6841,6 @@ PHP_METHOD(Imagick, getImageChannelStatistics) - #if MagickLibVersion >= 0x700 - for (i=0; i < sizeof(channels)/sizeof(channels[0]); i++) { - #ifdef ZEND_ENGINE_3 -- ZVAL_NEW_ARR(&tmp); - array_init(&tmp); - add_assoc_double(&tmp, "mean", statistics[i].mean); - add_assoc_double(&tmp, "minima", statistics[i].minima); -@@ -6869,7 +6868,6 @@ PHP_METHOD(Imagick, getImageChannelStatistics) - #else //below MagickLibVersion>= 0x700 - for (i = 0; i < elements ; i++) { - #ifdef ZEND_ENGINE_3 -- ZVAL_NEW_ARR(&tmp); - array_init(&tmp); - add_assoc_double(&tmp, "mean", statistics[channels[i]].mean); - add_assoc_double(&tmp, "minima", statistics[channels[i]].minima); -@@ -8703,7 +8701,7 @@ PHP_METHOD(Imagick, identifyImage) - // Geometry is an associative array - - #ifdef ZEND_ENGINE_3 -- ZVAL_NEW_ARR(&array); -+ array_init(&array); - pArray = &array; - #else - MAKE_STD_ZVAL(array); - -From 3c387a2b1a0b3a9cc08f878a2541b814f3b831bf Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Wed, 9 Jun 2021 09:40:16 +0200 -Subject: [PATCH 2/2] fix Implicit conversion - ---- - tests/172_ImagickPixel_setColorValueQuantum_basic.phpt | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt b/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt -index e69108e..bf68edf 100644 ---- a/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt -+++ b/tests/172_ImagickPixel_setColorValueQuantum_basic.phpt -@@ -13,7 +13,7 @@ function setColorValueQuantum() { - - $draw = new \ImagickDraw(); - $color = new \ImagickPixel('blue'); -- $color->setcolorValueQuantum(\Imagick::COLOR_RED, 128 * $quantumRange['quantumRangeLong'] / 256); -+ $color->setcolorValueQuantum(\Imagick::COLOR_RED, (int)(128 * $quantumRange['quantumRangeLong'] / 256)); - - $draw->setstrokewidth(1.0); - $draw->setStrokeColor($color); -@@ -33,4 +33,4 @@ setColorValueQuantum() ; - echo "Ok"; - ?> - --EXPECTF-- --Ok -\ No newline at end of file -+Ok |