commit: 149dee72b9bfab759a40fdf116590033c4dbca34 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org> AuthorDate: Mon May 22 14:30:09 2023 +0000 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org> CommitDate: Mon May 22 14:36:50 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=149dee72
dev-php/pecl-uploadprogress: fix tests with PHP's --enable-debug. A few of the tests for pecl-uploadprogress throw a fatal error if PHP was build with USE=debug. We skip the tests for now; a better long-term solution was proposed upstream (GH issue #17). In addition, the extension seems to work fine with php-8.2, so I've taken the opportunity to enable it. Closes: https://bugs.gentoo.org/906691 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org> .../files/php-debug-testfix.patch | 74 ++++++++++++++++++++++ ....ebuild => pecl-uploadprogress-2.0.2-r1.ebuild} | 7 +- 2 files changed, 79 insertions(+), 2 deletions(-) diff --git a/dev-php/pecl-uploadprogress/files/php-debug-testfix.patch b/dev-php/pecl-uploadprogress/files/php-debug-testfix.patch new file mode 100644 index 000000000000..febc989ab79b --- /dev/null +++ b/dev-php/pecl-uploadprogress/files/php-debug-testfix.patch @@ -0,0 +1,74 @@ +From 57f3c17c684a4e5607a322a24be306eb98d340ac Mon Sep 17 00:00:00 2001 +From: Michael Orlitzky <mich...@orlitzky.com> +Date: Mon, 22 May 2023 10:18:29 -0400 +Subject: [PATCH 1/1] tests: skip tests that fail with --enable-debug. + +With PHP debugging enabled, a few tests fail. The root cause of this +is that uploadprogress_get_contents() can return FALSE to indicate +that an error has occurred, but its declared type is string. It +would probably be better if the function raised an error rather +than abusing the return value, but that's a decision upstream +would have to agree too (see: Github issue 17). For now we just +skip the tests if PHP_DEBUG is defined. +--- + tests/uploadprogress_get_contents_error001.phpt | 2 ++ + tests/uploadprogress_get_contents_error003.phpt | 2 ++ + tests/uploadprogress_get_contents_variation002.phpt | 2 ++ + tests/uploadprogress_get_contents_variation006.phpt | 2 ++ + 4 files changed, 8 insertions(+) + +diff --git a/tests/uploadprogress_get_contents_error001.phpt b/tests/uploadprogress_get_contents_error001.phpt +index 63f4f5d..c3e10d9 100644 +--- a/tests/uploadprogress_get_contents_error001.phpt ++++ b/tests/uploadprogress_get_contents_error001.phpt +@@ -5,6 +5,8 @@ uploadprogress_get_contents - Warns when function is disabled + <?php + if (!extension_loaded('uploadprogress')) exit('skip extension not loaded'); + ++if (PHP_DEBUG) exit('skip test throws a fatal error with --enable-debug'); ++ + --INI-- + uploadprogress.get_contents = Off + +diff --git a/tests/uploadprogress_get_contents_error003.phpt b/tests/uploadprogress_get_contents_error003.phpt +index 1ea19b8..65d94c1 100644 +--- a/tests/uploadprogress_get_contents_error003.phpt ++++ b/tests/uploadprogress_get_contents_error003.phpt +@@ -5,6 +5,8 @@ uploadprogress_get_contents - Warns when maxlength is less than zero + <?php + if (!extension_loaded('uploadprogress')) exit('skip extension not loaded'); + ++if (PHP_DEBUG) exit('skip test throws a fatal error with --enable-debug'); ++ + --INI-- + uploadprogress.get_contents = On + +diff --git a/tests/uploadprogress_get_contents_variation002.phpt b/tests/uploadprogress_get_contents_variation002.phpt +index b4bf458..67b1b89 100644 +--- a/tests/uploadprogress_get_contents_variation002.phpt ++++ b/tests/uploadprogress_get_contents_variation002.phpt +@@ -5,6 +5,8 @@ uploadprogress_get_contents - File contents not found + <?php + if (!extension_loaded('uploadprogress')) exit('skip extension not loaded'); + ++if (PHP_DEBUG) exit('skip test throws a fatal error with --enable-debug'); ++ + --INI-- + uploadprogress.get_contents = On + +diff --git a/tests/uploadprogress_get_contents_variation006.phpt b/tests/uploadprogress_get_contents_variation006.phpt +index e19f8d5..ec70c78 100644 +--- a/tests/uploadprogress_get_contents_variation006.phpt ++++ b/tests/uploadprogress_get_contents_variation006.phpt +@@ -5,6 +5,8 @@ uploadprogress_get_contents - When contents file cannot be read + <?php + if (!extension_loaded('uploadprogress')) exit('skip extension not loaded'); + ++if (PHP_DEBUG) exit('skip test throws a fatal error with --enable-debug'); ++ + --INI-- + uploadprogress.get_contents = On + +-- +2.39.3 + diff --git a/dev-php/pecl-uploadprogress/pecl-uploadprogress-2.0.2.ebuild b/dev-php/pecl-uploadprogress/pecl-uploadprogress-2.0.2-r1.ebuild similarity index 71% rename from dev-php/pecl-uploadprogress/pecl-uploadprogress-2.0.2.ebuild rename to dev-php/pecl-uploadprogress/pecl-uploadprogress-2.0.2-r1.ebuild index 99572c452134..49f75395edd0 100644 --- a/dev-php/pecl-uploadprogress/pecl-uploadprogress-2.0.2.ebuild +++ b/dev-php/pecl-uploadprogress/pecl-uploadprogress-2.0.2-r1.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -USE_PHP="php7-4 php8-0 php8-1" +USE_PHP="php7-4 php8-0 php8-1 php8-2" PHP_EXT_SAPIS="apache2 fpm" inherit php-ext-pecl-r3 @@ -14,8 +14,11 @@ SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="examples" +PATCHES=( "${FILESDIR}/php-debug-testfix.patch" ) + RDEPEND=" php_targets_php7-4? ( || ( dev-lang/php:7.4[apache2(-),fileinfo(-)] dev-lang/php:7.4[fileinfo(-),fpm(-)] ) ) php_targets_php8-0? ( || ( dev-lang/php:8.0[apache2(-),fileinfo(-)] dev-lang/php:8.0[fileinfo(-),fpm(-)] ) ) php_targets_php8-1? ( || ( dev-lang/php:8.1[apache2(-),fileinfo(-)] dev-lang/php:8.1[fileinfo(-),fpm(-)] ) ) + php_targets_php8-2? ( || ( dev-lang/php:8.2[apache2(-),fileinfo(-)] dev-lang/php:8.2[fileinfo(-),fpm(-)] ) ) "