Imagick / imagick

🌈 The Imagick PHP extension 🌈
http://pecl.php.net/imagick
Other
540 stars 136 forks source link

php7 imagick/imagick_helpers.c["Cannot redefine class constant Imagick::LAYERMETHOD_COMPOSI"] #201

Closed landscape-ooo closed 7 years ago

landscape-ooo commented 7 years ago

========error from php-cli(fpm) log [09-Feb-2017 11:50:23 UTC] PHP Fatal error: Cannot redefine class constant Imagick::LAYERMETHOD_COMPOSITE in Unknown on line 0

========source code

if MagickLibVersion > 0x632

    IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COMPOSITE", CompositeLayer);

endif

if MagickLibVersion >= 0x637

    IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_COMPOSITE", CompositeLayer);

endif

landscape-ooo commented 7 years ago

if run in ImageMagick-6.5.4-10 ,which is >0x632 , could fail in such fatal error . some bug appear in “imagick_helpers.c” eg , 0x632< 0x637 ,if MagickLibVersion= 0x631 ,it will run into twice and redeclare LAYERMETHOD_COMPOSITE twice

landscape-ooo commented 7 years ago

diff --git a/imagick_helpers.c b/imagick_helpers.c index ba96892..a9aaccd 100644 --- a/imagick_helpers.c +++ b/imagick_helpers.c @@ -1528,7 +1528,7 @@ void php_imagick_initialize_constants(TSRMLS_D) IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_REMOVEZERO", RemoveZeroLayer);

endif

if MagickLibVersion >= 0x637

landscape-ooo commented 7 years ago

diff --git a/imagick_helpers.c b/imagick_helpers.c index ba96892..a9aaccd 100644 --- a/imagick_helpers.c +++ b/imagick_helpers.c @@ -1528,7 +1528,7 @@ void php_imagick_initialize_constants(TSRMLS_D) IMAGICK_REGISTER_CONST_LONG("LAYERMETHOD_REMOVEZERO", RemoveZeroLayer);

endif

if MagickLibVersion >= 0x637

Danack commented 7 years ago

Hi,

Thanks for the issue report - however you have completely confused me.

i. The word LAYERMETHOD_COMPOSITE only appears in the source code once

ii. All the tests pass on travis

iii. I can't see a commit starting with ba96892 in the recent history.

iv. Pull requests are far easier to process than patches.

Please can you check that you are using an up-to-date version of Imagick, and create a pull-request against that?

cheers Dan

Danack commented 7 years ago

Closing, as I don't think there is a problem in the current code.

Please feel free to update with more information.