diff --git a/Imagick_arginfo.h b/Imagick_arginfo.h index 1a1b24ab..9cc93469 100644 --- a/Imagick_arginfo.h +++ b/Imagick_arginfo.h @@ -2017,7 +2017,14 @@ ZEND_END_ARG_INFO() #define arginfo_class_Imagick_setLastIterator arginfo_class_Imagick_transposeImage -#define arginfo_class_Imagick_resetIterator arginfo_class_Imagick_transposeImage + +#if PHP_VERSION_ID >= 80000 +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_resetIterator, 0, 0, IS_VOID, 0) +#else +ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_resetIterator, 0, 0, 0) +#endif + +ZEND_END_ARG_INFO() #define arginfo_class_Imagick_previousImage arginfo_class_Imagick_transposeImage @@ -4899,16 +4906,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_key, 0, 0, 0) ZEND_END_ARG_INFO() #endif +#define arginfo_class_Imagick_next arginfo_class_Imagick_resetIterator -#if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_next, 0, 0, IS_VOID, 0) -#else -ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_next, 0, 0, 0) -#endif - -ZEND_END_ARG_INFO() - -#define arginfo_class_Imagick_rewind arginfo_class_Imagick_next +#define arginfo_class_Imagick_rewind arginfo_class_Imagick_resetIterator #define arginfo_class_Imagick_valid arginfo_class_Imagick_transposeImage @@ -5128,7 +5128,7 @@ ZEND_END_ARG_INFO() #if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_setAntialias, 0, 1, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_setAntialias, 0, 1, IS_VOID, 0) #else ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_setAntialias, 0, 0, 1) #endif @@ -5163,7 +5163,7 @@ ZEND_END_ARG_INFO() #if MagickLibVersion >= 0x687 #if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_optimizeImageTransparency, 0, 0, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_optimizeImageTransparency, 0, 0, IS_VOID, 0) #else ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_optimizeImageTransparency, 0, 0, 0) #endif @@ -5174,7 +5174,7 @@ ZEND_END_ARG_INFO() #if MagickLibVersion >= 0x660 #if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_autoGammaImage, 0, 0, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_autoGammaImage, 0, 0, IS_VOID, 0) #else ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_autoGammaImage, 0, 0, 0) #endif @@ -5186,7 +5186,7 @@ ZEND_END_ARG_INFO() #if MagickLibVersion >= 0x692 #if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_autoOrient, 0, 0, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_autoOrient, 0, 0, IS_VOID, 0) #else ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_autoOrient, 0, 0, 0) #endif @@ -5276,7 +5276,7 @@ ZEND_END_ARG_INFO() #if IM_HAVE_IMAGICK_GETSETIMAGEMASK #if PHP_VERSION_ID >= 80000 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_setImageMask, 0, 2, _IS_BOOL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_setImageMask, 0, 2, IS_VOID, 0) #else ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Imagick_setImageMask, 0, 0, 2) #endif diff --git a/imagick_class.c b/imagick_class.c index 8e407d67..93e1d871 100644 --- a/imagick_class.c +++ b/imagick_class.c @@ -4585,7 +4585,7 @@ PHP_METHOD(Imagick, newImage) zend_bool allocated; /* Parse parameters given to function */ - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz|s", &columns, &rows, ¶m, &format, &format_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "llz|s!", &columns, &rows, ¶m, &format, &format_len) == FAILURE) { RETURN_THROWS(); } diff --git a/tests/330_Imagick_newImage.phpt b/tests/330_Imagick_newImage.phpt new file mode 100644 index 00000000..b8fed43b --- /dev/null +++ b/tests/330_Imagick_newImage.phpt @@ -0,0 +1,32 @@ +--TEST-- +Test Imagick, newImage +--SKIPIF-- + +--FILE-- +newImage(100, 100, new ImagickPixel('red'), 'png'); +echo $image->getImageFormat(); +echo "\n"; + +$image = new Imagick(); +$image->newImage(100, 100, 'blue', null); + +try { + $image->getImageFormat(); +} +catch (ImagickException $ie) { + echo $ie->getMessage() . "\n"; +} + +echo "Ok"; +?> +--EXPECTF-- +PNG +Image has no format +Ok