Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building against PHP with enabled debug breaks tests (and function) #626

Open
fcool opened this issue Aug 10, 2023 · 11 comments
Open

Building against PHP with enabled debug breaks tests (and function) #626

fcool opened this issue Aug 10, 2023 · 11 comments

Comments

@fcool
Copy link

fcool commented Aug 10, 2023

Building against >= PHP 8.1 with enabled debug breaks the functionality of Imagick. In my scenario even just "reading" an image did not work any more.

The Test suite runs many of the tests still successful - but there are way more breaks than against a non debug php.

It would be great, if I could continue to use a DEBUG built PHP in development enviroments. ;)

@Danack
Copy link
Collaborator

Danack commented Aug 10, 2023

I don't see that behaviour. Or really understand what you mean by "did not work any more".

The Test suite runs many of the tests still successful - but there are way more breaks than against a non debug php.

Although some of the tests might fail, if you're seeing quite a lot of fails, that sounds not good.

Can you please provide any details of what you're seeing or how to replicate it?

@fcool
Copy link
Author

fcool commented Aug 12, 2023

Given PHP is compiled with ./configure --enable-debug flag:

  1. Unpack imagick-3.7.0.tgz
  2. Run phpize
  3. Run ./configure
  4. Run make test

This is the output:
https://gist.github.com/fcool/8204a7b1dc4379a8a91899fa8e3600f5

The same procedure with a PHP build without --enable-debug brings a better result (and actually works):
https://gist.github.com/fcool/a92c948aeeb7430aeff0662da452ce34

@Danack
Copy link
Collaborator

Danack commented Aug 12, 2023

Can you put the diff output from some of the failed tests. They will be in the same directory as the tests, and have a file extension of .diff.

It's fine to put them here rather than in a gist.

@fcool
Copy link
Author

fcool commented Aug 12, 2023

for file in *.diff; do echo; echo; echo $file; echo "###################################"; cat $file; done


014-setresourcelimit.diff
###################################
001+ Fatal error: Imagick::getResourceLimit(): Return value must be of type int, float returned in Unknown on line 0
001- success

020-pixeliterator.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
002+ 
001- %s: ImagickPixelIterator::newPixelIterator is deprecated. ImagickPixelIterator::getPixelIterator should be used instead in %s on line %d
002- done
003+ Termsig=6

031_Imagick_affineTransformImage_basic.diff
###################################
     Checking white
     Stats checked
004+ Channel blue is wrong 65535 vs 0
     Stats checked
     Ok

047_Imagick_convolveImage_7.diff
###################################
001+ Fatal error: Arginfo / zpp mismatch during call of ImagickKernel::fromMatrix() in /tmp/imagick-3.7.0/tests/047_Imagick_convolveImage_7.php on line 13
001- Ok

083_Imagick_getPixelIterator_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

084_Imagick_getPixelRegionIterator_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

092_Imagick_mergeImageLayers_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
001- Ok
002+ 
003+ Termsig=6

145_imagickkernel_coverage.diff
###################################
001+ Fatal error: Arginfo / zpp mismatch during call of ImagickKernel::fromMatrix() in /tmp/imagick-3.7.0/tests/145_imagickkernel_coverage.php on line 10
001- Complete

150_Imagick_setregistry.diff
###################################
001+ Fatal error: Imagick::getRegistry(): Return value must be of type string, bool returned in Unknown on line 0
001- Temporary-path was empty at start.
002- Temporary path was set correctly.
003- Temporary path was listed correctly.
004- This is fine.

151_Imagick_subImageMatch_basic.diff
###################################
001+ Fatal error: Arginfo / zpp mismatch during call of Imagick::subimageMatch() in /tmp/imagick-3.7.0/tests/151_Imagick_subImageMatch_basic.php on line 18
001- height : 25
002- width : 25
003- x : 50
004- y : 50
005- Ok

229_Tutorial_fxAnalyzeImage_case1.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

236_Imagick_identify_basic.diff
###################################
     format: png (portable network graphics)
     units: undefined
     type: palette
004+ Image geometry 640x480[Sat Aug 12 15:38:42 2023]  Script:  '/tmp/imagick-3.7.0/tests/236_Imagick_identify_basic.php'
004- Image geometry 640x480
005+ /usr/lib64/php8.1/include/php/Zend/zend_string.h(150) :  Freeing 0x00007f9dea202700 (72 bytes), script=/tmp/imagick-3.7.0/tests/236_Imagick_identify_basic.php
006+ Last leak repeated 598 times
007+ [Sat Aug 12 15:38:42 2023]  Script:  '/tmp/imagick-3.7.0/tests/236_Imagick_identify_basic.php'
008+ /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_hash.c(281) :  Freeing 0x00007f9dea2b0000 (56 bytes), script=/tmp/imagick-3.7.0/tests/236_Imagick_identify_basic.php
009+ === Total 600 memory leaks detected ===

246_antialias_image.diff
###################################
     true
002+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
003+ 
002- false
003- true
004+ Termsig=6

247_ImagickPixelIterator_construct_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

248_ImagickPixelIterator_clear_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

249_ImagickPixelIterator_getNextIteratorRow_basic.diff
###################################
001+ Fatal error: ImagickPixelIterator::getNextIteratorRow(): Return value must be of type array, null returned in Unknown on line 0
001- Ok

250_ImagickPixelIterator_resetIterator_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

252_ImagickPixelIterator_construct_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
001- Ok
002+ 
003+ Termsig=6

258_Imagick_evaluateImages_basic.diff
###################################
001+ Fatal error: Imagick::evaluateImages(): Return value must be of type bool, Imagick returned in Unknown on line 0
001- Ok

259_Imagick_colorPoints_basic.diff
###################################
001+ Fatal error: Arginfo / zpp mismatch during call of Imagick::setImageRedPrimary() in /tmp/imagick-3.7.0/tests/259_Imagick_colorPoints_basic.php on line 38
001- Ok

260_localContrastImage.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
001- Ok
002+ 
003+ Termsig=6

262_autoOrient.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
001- Ok
002+ 
003+ Termsig=6

263_autoGammaImage.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
001- Ok
002+ 
003+ Termsig=6

278_Imagick_optimaze_gif.diff
###################################
--
     Frame: 3
     Frame: 4
     Frame: 5
007+ 
007- Ok
008+ Fatal error: Imagick::optimizeImageLayers(): Return value must be of type bool, Imagick returned in Unknown on line 0

286_Imagick_setMask_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
001- Ok
002+ 
003+ Termsig=6

289_Imagick_setImageMask_basic.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_vm_execute.h:1771: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, ret)' failed.
001- Ok
002+ 
003+ Termsig=6

292_index_iterator.diff
###################################
001+ php: /var/tmp/portage/dev-lang/php-8.1.16/work/sapis-build/cli/Zend/zend_execute_API.c:934: zend_call_function: Assertion `!(call->func->common.fn_flags & (1 << 13)) || zend_verify_internal_return_type(call->func, fci->retval)' failed.
002+ 
003+ Termsig=6
001- 0
002- 0
003- 1
004- 1
005- 2
006- 2
007- 0
008- 1
009- 2
010- 0
011- 1
012- 2
013- still 2 as hasn't changed
014- Exception: Unable to set image index
015- Ok

325_Imagick_setDepth.diff
###################################
     Depth is 16
002+ 
002- Ok
003+ Fatal error: Imagick::getImageBlob(): Return value must be of type string, null returned in Unknown on line 0

@fcool
Copy link
Author

fcool commented Aug 12, 2023

(sorry for the previous message... I messed the output - corrected now)

@Danack
Copy link
Collaborator

Danack commented Aug 12, 2023

Ooh, ok. Can you do me a favour and show the output of var_dump(Imagick::getCopyright());

@fcool
Copy link
Author

fcool commented Aug 12, 2023

Output does not change depending on the debug flag, so here it comes: (that means, that this call to Imagick obviously does work even with --enable-debug ;) )

string(31) "(C) 1999 ImageMagick Studio LLC"

@fcool
Copy link
Author

fcool commented Aug 12, 2023

installed is version 7.1.1.11 of ImageMagick - do you think an older version of ImageMagick might be a solution?

Feels strange, as it works without the --enable-debug flag, I was more or less sure, that it cannot be related to the version of ImageMagick. But I'm sure you know far better than me.

@Danack
Copy link
Collaborator

Danack commented Aug 13, 2023

But I'm sure you know far better than me.

Actually maybe not. Tbh, kind of been struggling with a chronic pain problem, which seems to flare up when I look at the Imagick problem, and I have a horrible suspicion that I need to merge some PRs that have been open, that might actually address this problem, that I have been trying to ignore.

@fcool
Copy link
Author

fcool commented Aug 13, 2023

Don't risk your health! No build problem can be that important. I have my share of experience with chronic pain...

And even if I miss the possibility to have PHP in a debug mode AND imagick at the same time... At least it seems a "not so often" needed use case, looking at the age of PHP 8.1 and me being the first to notice. And hey... if I'd really care, I could solve the problem probably myself. (But that would mean to greatly improve my knowledge in some areas - learning is a good thing, isn't it?)

Anyway: If you have an idea, what I could check to help you save your time, just let me know. Or maybe you have some advice, where I could investigate?

@orlitzky
Copy link

And even if I miss the possibility to have PHP in a debug mode AND imagick at the same time... At least it seems a "not so often" needed use case, looking at the age of PHP 8.1 and me being the first to notice.

It's not just you, last week someone reported the same failure on Gentoo linux: https://bugs.gentoo.org/911661

I finally got around to investigating it today, and sure enough, the problem is --enable-debug. Then I come here to report the issue and look what's right at the top of the issue list :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants