Imagick::profileImage() fix to allow null as second parameter again.

Fixed #456
This commit is contained in:
Danack
2021-10-01 18:11:02 +01:00
parent f452e76821
commit 0d5134f635
5 changed files with 40 additions and 5 deletions
+1 -1
View File
@@ -1040,7 +1040,7 @@ class Imagick
// PREVIEW_*
public function previewImages(int $preview): bool {}
public function profileImage(string $name, string $profile): bool {}
public function profileImage(string $name, ?string $profile): bool {}
public function quantizeImage(
int $number_colors,
+21 -2
View File
@@ -4223,7 +4223,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_profileImage, 0, 0, 2)
#endif
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO(0, profile, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, profile, IS_STRING, 1)
#else
ZEND_ARG_INFO(0, profile)
#endif
@@ -4470,7 +4470,26 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_setImageInterlaceScheme, 0, 0, 1)
#endif
ZEND_END_ARG_INFO()
#define arginfo_class_Imagick_setImageProfile arginfo_class_Imagick_profileImage
#if PHP_VERSION_ID >= 80000
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_setImageProfile, 0, 2, _IS_BOOL, 0)
#else
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_setImageProfile, 0, 0, 2)
#endif
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
#else
ZEND_ARG_INFO(0, name)
#endif
#if PHP_VERSION_ID >= 80000
ZEND_ARG_TYPE_INFO(0, profile, IS_STRING, 0)
#else
ZEND_ARG_INFO(0, profile)
#endif
ZEND_END_ARG_INFO()
#define arginfo_class_Imagick_setImageRedPrimary arginfo_class_Imagick_setImageBluePrimary
+2 -2
View File
@@ -5085,7 +5085,7 @@ PHP_METHOD(Imagick, previewImages)
}
/* }}} */
/* {{{ proto bool Imagick::profileImage(string name,string profile)
/* {{{ proto bool Imagick::profileImage(string name, string|null profile)
Adds or removes a ICC, IPTC, or generic profile from an image. If the profile is NULL, it is removed from the image otherwise added. Use a name of '*' and a profile of NULL to remove all profiles from the image.
*/
PHP_METHOD(Imagick, profileImage)
@@ -5096,7 +5096,7 @@ PHP_METHOD(Imagick, profileImage)
MagickBooleanType status;
/* Parse parameters given to function */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &name, &name_len, &profile, &profile_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss!", &name, &name_len, &profile, &profile_len) == FAILURE) {
return;
}
+1
View File
@@ -351,6 +351,7 @@ This extension requires ImageMagick version 6.5.3-10+ and PHP 5.4.0+.
<file name="287_Imagick_GetImageChannelRange_basic.phpt" role="test" />
<file name="288_imagick_prevent_zero_size_images.phpt" role="test" />
<file name="289_Imagick_setImageMask_basic.phpt" role="test" />
<file name="290_imagick_profileimage.phpt" role="test" />
<file name="bug20636.phpt" role="test" />
<file name="bug21229.phpt" role="test" />
<file name="bug59378.phpt" role="test" />
+15
View File
@@ -0,0 +1,15 @@
--TEST--
Imagick::profileImage test
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$imagick = new Imagick();
$imagick->newPseudoImage(640, 480, "magick:logo");
$imagick->profileImage('*', null);
echo "Ok";
?>
--EXPECTF--
Ok