Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion imagick_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -13492,8 +13492,12 @@ PHP_METHOD(Imagick, colorThresholdImage)
return;

stop_color_wand = php_imagick_zval_to_pixelwand (stop_color_param, IMAGICK_CLASS, &stop_color_allocated TSRMLS_CC);
if (!stop_color_wand)
if (!stop_color_wand) {
if (start_color_allocated)
start_color_wand = DestroyPixelWand (start_color_wand);

return;
}

status = MagickColorThresholdImage(
intern->magick_wand,
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ This extension requires ImageMagick version 6.5.3-10+ and PHP 5.6.0+.
<file name="310_Imagick_whiteBalanceImage.phpt" role="test" />
<file name="311_Imagick_channelFxImage.phpt" role="test" />
<file name="312_Imagick_colorThresholdImage.phpt" role="test" />
<file name="313_Imagick_colorThresholdImage_invalid.phpt" role="test" />
<file name="314_Imagick_getBackgroundColor.phpt" role="test" />
<file name="315_Imagick_getImageArtifacts.phpt" role="test" />
<file name="316_Imagick_getImageKurtosis.phpt" role="test" />
Expand Down
26 changes: 26 additions & 0 deletions tests/313_Imagick_colorThresholdImage_invalid.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
Test Imagick, colorThresholdImage invalid input
--SKIPIF--
<?php
require_once(dirname(__FILE__) . '/skipif.inc');
checkClassMethods('Imagick', array('colorThresholdImage'));
?>
--FILE--
<?php

function colorThresholdImage() {
$imagick = new \Imagick(__DIR__ . '/Biter_500.jpg');
try {
$imagick->colorThresholdImage(
"rgb(10, 10, 10)",
"complete garbage"
);
} catch (ImagickException $e) {
echo "ImagickException: ", $e->getMessage(), "\n";
}
}

colorThresholdImage() ;
?>
--EXPECTF--
ImagickException: Unrecognized color string