From bb9a670c83dbf15db7ed7ddcbda16d32e902a082 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Till=20Kru=CC=88ss?= Date: Wed, 29 Sep 2021 10:43:13 -0700 Subject: [PATCH] add php 8.1 patches for phpunit --- tests/apply-patches.php | 1 + tests/phpunit_php81.patch | 50 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 tests/phpunit_php81.patch diff --git a/tests/apply-patches.php b/tests/apply-patches.php index 735093db..61ff5986 100644 --- a/tests/apply-patches.php +++ b/tests/apply-patches.php @@ -7,6 +7,7 @@ $patches = array( 'phpunit_mock_objects.patch' => 'phpunit/phpunit-mock-objects', 'phpunit_php7.patch' => 'phpunit/phpunit', 'phpunit_php8.patch' => 'phpunit/phpunit', + 'phpunit_php81.patch' => 'phpunit/phpunit', ); foreach ($patches as $patch => $package) { diff --git a/tests/phpunit_php81.patch b/tests/phpunit_php81.patch new file mode 100644 index 00000000..598219e0 --- /dev/null +++ b/tests/phpunit_php81.patch @@ -0,0 +1,50 @@ +diff --git a/src/Util/Configuration.php b/src/Util/Configuration.php +index b2f7a7bd0c6..1a1a444d378 100644 +--- a/src/Util/Configuration.php ++++ b/src/Util/Configuration.php +@@ -514,22 +514,17 @@ public function handlePHPConfiguration() + + foreach (array('var', 'post', 'get', 'cookie', 'server', 'files', 'request') as $array) { + // See https://github.com/sebastianbergmann/phpunit/issues/277 +- switch ($array) { +- case 'var': +- $target = &$GLOBALS; +- break; +- +- case 'server': +- $target = &$_SERVER; +- break; +- +- default: +- $target = &$GLOBALS['_' . strtoupper($array)]; +- break; +- } +- + foreach ($configuration[$array] as $name => $value) { +- $target[$name] = $value; ++ switch ($array) { ++ case 'var': ++ $GLOBALS[$name] = $value; ++ break; ++ case 'server': ++ $_SERVER[$name] = $value; ++ break; ++ default: ++ $GLOBALS['_' . strtoupper($array)][$name] = $value; ++ } + } + } + +diff --git a/src/Util/Getopt.php b/src/Util/Getopt.php +index 370e97d73f8..5bd8553970b 100644 +--- a/src/Util/Getopt.php ++++ b/src/Util/Getopt.php +@@ -144,7 +144,7 @@ protected static function parseLongOption($arg, $long_options, &$opts, &$args) + + if (substr($long_opt, -1) == '=') { + if (substr($long_opt, -2) != '==') { +- if (!strlen($opt_arg)) { ++ if (null === $opt_arg || strlen($opt_arg) < 1) { + $opt_arg = current($args); + next($args); + if (!($opt_arg)) {