I tried using PHPUnit 9 but it is not supporting the latest version of PHP above 8.0 I am receiving this following error
Fatal error: Uncaught Error: Call to undefined function each[] in C:\xampp\php\pear\PHPUnit\Util\Getopt.php:80 Stack trace: #0 C:\xampp\php\pear\PHPUnit\TextUI\Command.php[242]: PHPUnit_Util_Getopt::getopt[Array, 'd:c:hv', Array] #1 C:\xampp\php\pear\PHPUnit\TextUI\Command.php[138]: PHPUnit_TextUI_Command->handleArguments[Array] #2 C:\xampp\php\pear\PHPUnit\TextUI\Command.php[129]: PHPUnit_TextUI_Command->run[Array, true] #3 C:\xampp\php\phpunit[46]: PHPUnit_TextUI_Command::main[] #4 {main} thrown in C:\xampp\php\pear\PHPUnit\Util\Getopt.php on line 80
hi, i'm having an issue with one of my projects, this is the response i'm getting. could somebody help me how to move forward with this? thanks!
$ phpunit
PHP Fatal error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration[] in /home/travis/build/gabrielkaputa/bitly/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1042
PHP Stack trace:
PHP 1. {main}[] /home/travis/.phpenv/versions/5.6.5/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main[] /home/travis/.phpenv/versions/5.6.5/bin/phpunit:722
PHP 3. PHPUnit_TextUI_Command->run[]
phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:104
PHP 4. PHPUnit_TextUI_TestRunner->doRun[] phar:///home/travis/.phpenv/versions/5.6.5/bin/phpunit/phpunit/TextUI/Command.php:152
PHP 5. PHPUnit_TextUI_TestRunner->handleConfiguration[] /home/travis/build/gabrielkaputa/bitly/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:163
[PHPUnit] PHP Fatal error: Uncaught Error: Call to undefined function each[]
Questions : [PHPUnit] PHP Fatal error: Uncaught Error: Call to undefined function each[]
2022-09-24T14:29:39+00:00 2022-09-24T14:29:39+00:00
708
firstly I was receiving a warning and a anycodings_php fatal error. The warning:
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
Then I replaced the continue with break and anycodings_php the warning disappeared. But even after the anycodings_php replacement, the fatal error still happens. anycodings_php The fatal error:
PHP Fatal error: Uncaught Error: Call to undefined function each[] in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php[242]: PHPUnit_Util_Getopt::getopt[Array, 'd:c:hv', Array]
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php[138]: PHPUnit_TextUI_Command->handleArguments[Array]
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php[129]: PHPUnit_TextUI_Command->run[Array, true]
#3 D:\xampp\php\phpunit[46]: PHPUnit_TextUI_Command::main[]
#4 {main}
thrown in D:\xampp\php\pear\PHPUnit\Util\Getopt.php on line 80
Fatal error: Uncaught Error: Call to undefined function each[] in D:\xampp\php\pear\PHPUnit\Util\Getopt.php:80
Stack trace:
#0 D:\xampp\php\pear\PHPUnit\TextUI\Command.php[242]: PHPUnit_Util_Getopt::getopt[Array, 'd:c:hv', Array]
#1 D:\xampp\php\pear\PHPUnit\TextUI\Command.php[138]: PHPUnit_TextUI_Command->handleArguments[Array]
#2 D:\xampp\php\pear\PHPUnit\TextUI\Command.php[129]: PHPUnit_TextUI_Command->run[Array, true]
#3 D:\xampp\php\phpunit[46]: PHPUnit_TextUI_Command::main[]
The line 77-83 of Getopt.php
reset[$args];
array_map['trim', $args];
while [list[$i, $arg] = each[$args]] {
if [$arg == ''] {
continue;
}
Im using PHP 8.0.1 and the PHPUnit 9 [at anycodings_php least I think, because I cant use commands anycodings_php to check, and I downloaded it after february anycodings_php 7]
Total Answers 2
27
Answers 1 : of [PHPUnit] PHP Fatal error: Uncaught Error: Call to undefined function each[]
not an expert of PHPUnit but the "each" anycodings_php function is not available anymore in PHP anycodings_php 8
Warning: This function has been anycodings_php DEPRECATED as of PHP 7.2.0, and anycodings_php REMOVED as of PHP 8.0.0. Relying on this anycodings_php function is highly discouraged.
Taken from the PHP site
Probably the PHPUnit version you're anycodings_php using is not up-to-date yet for PHP anycodings_php 8. Check the version if you can and then anycodings_php see here PHPUnit version support
0
2022-09-24T14:29:39+00:00 2022-09-24T14:29:39+00:00Answer Link
mRahman
5
Answers 2 : of [PHPUnit] PHP Fatal error: Uncaught Error: Call to undefined function each[]
Probably the PHPUnit version you're anycodings_php using is not up-to-date yet for PHP anycodings_php 8 try
while [list[$i, $arg] = each[$args]] {
into
foreach [$arg as $arg,] {
0
2022-09-24T14:29:39+00:00 2022-09-24T14:29:39+00:00Answer Link
miraj