Test failures with --enable-debug
With php-8.x built with --enable-debug, we get a few test failures:
FAIL uploadprogress_get_contents - File contents not found [tests/uploadprogress_get_contents_variation002.phpt]
FAIL uploadprogress_get_contents - Warns when function is disabled [tests/uploadprogress_get_contents_error001.phpt]
FAIL uploadprogress_get_contents - Warns when maxlength is less than zero [tests/uploadprogress_get_contents_error003.phpt]
FAIL uploadprogress_get_contents - When contents file cannot be read [tests/uploadprogress_get_contents_variation006.phpt]
These are all expecting a bool(false) as the last line of the output, but instead we're getting
PHP Fatal error: uploadprogress_get_contents(): Return value must be of type ?string, bool returned in Unknown on line 0
This should be pretty easy to avoid by checking for PHP_DEBUG and skipping those tests, or maybe there's some way to allow for both possible outputs? I guess it depends on how important that bool(false) is. I'm happy to make the pull request either way.
I've thought about this for a bit, and I think the best thing to do would be to change the two warnings in uploadprogress_get_contents() to errors. If you try to call a function that's been disabled, that's comparable to calling a function that doesn't exist, which already throws a fatal error. Moreover it's no harder for programmers to check for uploadprogress.get_contents = On than it is to check for a special return value of false.
This would fix the failing tests because the output would become consistent: you'd get the same fatal error with or without --enable-debug. It would also make the return type of the function actually agree with the declared type (string).
Of course the downside is that the change wouldn't be backwards compatible.
Temporary workaround here: https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-php/pecl-uploadprogress/files/php-debug-testfix.patch