From 7a689f4a312ed0220ec3fccc1a11573298413b3c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 10 Sep 2021 08:30:54 +0200 Subject: add minimal patch for PHP 8.1 --- phpunit7-php8.patch | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++ phpunit7.spec | 7 ++++-- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/phpunit7-php8.patch b/phpunit7-php8.patch index abe16d5..c5c9e06 100644 --- a/phpunit7-php8.patch +++ b/phpunit7-php8.patch @@ -256,3 +256,64 @@ diff -up ./tests/unit/Framework/Constraint/JsonMatchesErrorMessageProviderTest.p ], 'JSON_ERROR_DEPTH' => [ 'Maximum stack depth exceeded', \JSON_ERROR_DEPTH, '', +diff -up ./src/Util/Configuration.php.old ./src/Util/Configuration.php +--- ./src/Util/Configuration.php.old 2021-09-10 08:26:04.654231054 +0200 ++++ ./src/Util/Configuration.php 2021-09-10 08:27:14.019129699 +0200 +@@ -567,24 +567,27 @@ final class Configuration + */ + switch ($array) { + case 'var': +- $target = &$GLOBALS; ++ foreach ($configuration[$array] as $name => $data) { ++ $GLOBALS[$name] = $data['value']; ++ } + + break; + + case 'server': +- $target = &$_SERVER; ++ foreach ($configuration[$array] as $name => $data) { ++ $_SERVER[$name] = $data['value']; ++ } + + break; + + default: +- $target = &$GLOBALS['_' . \strtoupper($array)]; ++ foreach ($configuration[$array] as $name => $data) { ++ $GLOBALS['_' . \strtoupper($array)][$name] = $data['value']; ++ } + + break; + } + +- foreach ($configuration[$array] as $name => $data) { +- $target[$name] = $data['value']; +- } + } + + foreach ($configuration['env'] as $name => $data) { +diff -up ./src/Util/PHP/Template/TestCaseClass.tpl.dist.old ./src/Util/PHP/Template/TestCaseClass.tpl.dist +--- ./src/Util/PHP/Template/TestCaseClass.tpl.dist.old 2021-09-10 08:26:32.213191401 +0200 ++++ ./src/Util/PHP/Template/TestCaseClass.tpl.dist 2021-09-10 08:26:55.407157223 +0200 +@@ -87,7 +87,7 @@ if ('' !== $configurationFilePath) { + unset($configuration); + } + +-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext) ++function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext=null) + { + return true; + } +diff -up ./src/Util/PHP/Template/TestCaseMethod.tpl.dist.old ./src/Util/PHP/Template/TestCaseMethod.tpl.dist +--- ./src/Util/PHP/Template/TestCaseMethod.tpl.dist.old 2021-09-10 08:26:26.609199466 +0200 ++++ ./src/Util/PHP/Template/TestCaseMethod.tpl.dist 2021-09-10 08:26:48.235167829 +0200 +@@ -89,7 +89,7 @@ if ('' !== $configurationFilePath) { + unset($configuration); + } + +-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext) ++function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext=null) + { + return true; + } diff --git a/phpunit7.spec b/phpunit7.spec index 3d45be7..0ca8082 100644 --- a/phpunit7.spec +++ b/phpunit7.spec @@ -28,7 +28,7 @@ Name: %{pk_project}%{ver_major} Version: %{ver_major}.%{ver_minor}.%{ver_patch} -Release: 5%{?dist} +Release: 7%{?dist} Summary: The PHP Unit Testing framework version %{ver_major} License: BSD @@ -260,7 +260,7 @@ sed -e 's:@PATH@:%{buildroot}%{php_home}/%{ns_vendor}:' -i tests/bootstrap.php sed -e 's:%{php_home}/%{ns_vendor}:%{buildroot}%{php_home}/%{ns_vendor}:' -i phpunit ret=0 -for cmd in php php73 php74 php80; do +for cmd in php php73 php74 php80 php81; do if which $cmd; then OPT="--testsuite=unit --no-coverage" VER=$($cmd -r 'echo PHP_VERSION_ID;'); @@ -293,6 +293,9 @@ exit $ret %changelog +* Fri Sep 10 2021 Remi Collet - 7.5.20-7 +- add minimal patch for PHP 8.1 + * Fri Mar 26 2021 Remi Collet - 7.5.20-5 - more fix for PHP 8 -- cgit