Skip to content

Commit

Permalink
Removed erroring on version mismatch. It now just gives a warning. Ad…
Browse files Browse the repository at this point in the history
…ded ability to suppress the version mismatch warning. Added skip_version_check to ChangeLog, remove a few items that are not interesting.
  • Loading branch information
Danack committed Mar 10, 2015
1 parent 8caceb2 commit f2dab71
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 27 deletions.
11 changes: 6 additions & 5 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* Imagick::selectiveBlurImage()
* Imagick::setImageBiasQuantum()
* Imagick::setProgressMonitor()
* Imagick::setRegistry()
* Imagick::setRegistry() - which allows setting the "temporary-path" used by ImageMagick
* Imagick::statisticImage()
* Imagick::subImageMatch()
* ImagickPixel::getColorQuantum()
Expand All @@ -30,7 +30,6 @@
* Imagick::ALPHACHANNEL_BACKGROUND
* Imagick::FUNCTION_ARCSIN
* Imagick::FUNCTION_ARCTAN
- Added spec to build rpm
- Fixed Imagick::clutImage() parameter parsing
- Fixed tint image bug
- Fixed ImageMagick compiled with HDRI having quantum values as floats
Expand All @@ -43,9 +42,6 @@
* Imagick::getSamplingFactors()
* Imagick::identifyImage()
* Imagick::tintImage
- Fixed wrong type_spec in ImagickPixelIterator::getPixelRegionIterator()
- Fixed compilation to look for headers in the user specified location first
- Fixed compilation error
- Fixed segfault when compiling statically
- ImagickDraw::setFontFamily no longer checks whether the font is available. This allows a
font family to be set where the family name is not the same as the font name. However it also
Expand All @@ -72,6 +68,11 @@
This is replaced by $im = $im->mergeImageLayers(\Imagick::LAYERMETHOD_FLATTEN)
* Imagick::getImageChannelExtrema()
* Imagick::getImageExtrema()
- Ini file changes
* Added imagick.skip_version_check. Imagick now checks that it was compiled against the same version of
ImageMagick that it is being run with, and will give a warning if it was compiled against a different
version of ImageMagick. The skip_version_check setting allows you to suppress this warning. However
it is strongly recommended to use the version of ImageMagick that Imagick was compiled against.
- Misc:
* CI now compiles with CFLAGS="-Wno-deprecated-declarations -Wdeclaration-after-statement -Werror"

Expand Down
35 changes: 13 additions & 22 deletions imagick.c
Original file line number Diff line number Diff line change
Expand Up @@ -2880,13 +2880,15 @@ static zend_object_value php_imagickkernel_object_new(zend_class_entry *class_ty

PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("imagick.locale_fix", "0", PHP_INI_ALL, OnUpdateBool, locale_fix, zend_imagick_globals, imagick_globals)
STD_PHP_INI_ENTRY("imagick.skip_version_check", "0", PHP_INI_ALL, OnUpdateBool, skip_version_check, zend_imagick_globals, imagick_globals)
STD_PHP_INI_ENTRY("imagick.progress_monitor", "0", PHP_INI_SYSTEM, OnUpdateBool, progress_monitor, zend_imagick_globals, imagick_globals)
PHP_INI_END()

static void php_imagick_init_globals(zend_imagick_globals *imagick_globals)
{
imagick_globals->locale_fix = 0;
imagick_globals->progress_monitor = 0;
imagick_globals->skip_version_check = 0;
}

static int php_imagick_count_elements(zval *object, long *count TSRMLS_DC) /* {{{ */
Expand Down Expand Up @@ -3056,7 +3058,7 @@ static zend_object_value php_imagick_clone_imagickkernel_object(zval *this_ptr T
#endif


static int checkImagickVersion()
static void checkImagickVersion()
{
//This gets the version that Imagick was compiled against.
size_t imagickVersion = MagickLibVersion;
Expand All @@ -3067,37 +3069,21 @@ static int checkImagickVersion()
GetMagickVersion(&imageMagickLibraryVersion);

if (imagickVersion == imageMagickLibraryVersion) {
return SUCCESS;
}

if ((imagickVersion & imageMagickLibraryVersion & 0xfff0) != 0) {
zend_error(
E_WARNING,
"Version warning: Imagick was compiled against Image Magick version %lu but version %lu is loaded. Imagick will run but may behave surprisingly.",
(unsigned long)imagickVersion,
(unsigned long)imageMagickLibraryVersion
);
return SUCCESS;
return;
}

zend_error(
E_ERROR,
"Version error: Imagick was compiled against Image Magick version %lu but version %lu is loaded. Imagick will not run.",
(long)imagickVersion,
(long)imageMagickLibraryVersion
E_WARNING,
"Version warning: Imagick was compiled against Image Magick version %lu but version %lu is loaded. Imagick will run but may behave surprisingly",
(unsigned long)imagickVersion,
(unsigned long)imageMagickLibraryVersion
);

return FAILURE;
}

PHP_MINIT_FUNCTION(imagick)
{
zend_class_entry ce;

if (checkImagickVersion() != SUCCESS) {
return FAILURE;
}

/* Initialize globals */
ZEND_INIT_MODULE_GLOBALS(imagick, php_imagick_init_globals, NULL);

Expand Down Expand Up @@ -3211,6 +3197,11 @@ PHP_MINIT_FUNCTION(imagick)
#endif

REGISTER_INI_ENTRIES();

if (!IMAGICK_G(skip_version_check)) {
checkImagickVersion();
}

return SUCCESS;
}

Expand Down
1 change: 1 addition & 0 deletions php_imagick_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ typedef struct _php_imagick_callback {
ZEND_BEGIN_MODULE_GLOBALS(imagick)
zend_bool locale_fix;
zend_bool progress_monitor;
zend_bool skip_version_check;
php_imagick_callback *progress_callback;
#ifdef PHP_IMAGICK_ZEND_MM
MagickWand *keep_alive;
Expand Down

0 comments on commit f2dab71

Please sign in to comment.