Skip to content Skip to sidebar Skip to footer

Fix PHP Fatal error Uncaught ArgumentCountError array_merge()

PHP Fatal error Uncaught ArgumentCountError

PHP Fatal error Uncaught ArgumentCountError array_merge() - This is the error I get when I want to run "composer install" or "composer update". In this terminal an error appears which makes me confused. What's wrong with this error.

But after researching, I get the result that the "composer.json" file is not found here. Here is the error I received:

Fix PHP Fatal error Uncaught ArgumentCountError array_merge()
PHP Fatal error:  Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(740): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(489): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(232): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/UpdateCommand.php(163): Composer\Installer->run()
#8 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\UpdateCommand->execute()
#9 /usr/share/php/Symfony/Component/Console/Application.php(934): Symfony\Component\Console\Command\Command->run()
#10 /usr/share/php/Symfony/Component/Console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#11 /usr/share/php/Composer/Console/Application.php(281): Symfony\Component\Console\Application->doRun()
#12 /usr/share/php/Symfony/Component/Console/Application.php(149): Composer\Console\Application->doRun()
#13 /usr/share/php/Composer/Console/Application.php(113): Symfony\Component\Console\Application->run()
#14 /usr/bin/composer(62): Composer\Console\Application->run()
#15 {main}
  thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

Fatal error: Uncaught ArgumentCountError: array_merge() does not accept unknown named parameters in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php:84
Stack trace:
#0 [internal function]: array_merge()
#1 /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php(84): call_user_func_array()
#2 /usr/share/php/Composer/DependencyResolver/Solver.php(387): Composer\DependencyResolver\DefaultPolicy->selectPreferredPackages()
#3 /usr/share/php/Composer/DependencyResolver/Solver.php(740): Composer\DependencyResolver\Solver->selectAndInstall()
#4 /usr/share/php/Composer/DependencyResolver/Solver.php(231): Composer\DependencyResolver\Solver->runSat()
#5 /usr/share/php/Composer/Installer.php(489): Composer\DependencyResolver\Solver->solve()
#6 /usr/share/php/Composer/Installer.php(232): Composer\Installer->doInstall()
#7 /usr/share/php/Composer/Command/UpdateCommand.php(163): Composer\Installer->run()
#8 /usr/share/php/Symfony/Component/Console/Command/Command.php(255): Composer\Command\UpdateCommand->execute()
#9 /usr/share/php/Symfony/Component/Console/Application.php(934): Symfony\Component\Console\Command\Command->run()
#10 /usr/share/php/Symfony/Component/Console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#11 /usr/share/php/Composer/Console/Application.php(281): Symfony\Component\Console\Application->doRun()
#12 /usr/share/php/Symfony/Component/Console/Application.php(149): Composer\Console\Application->doRun()
#13 /usr/share/php/Composer/Console/Application.php(113): Symfony\Component\Console\Application->run()
#14 /usr/bin/composer(62): Composer\Console\Application->run()
#15 {main}
  thrown in /usr/share/php/Composer/DependencyResolver/DefaultPolicy.php on line 84

How to Fix this PHP Error

Create a file called "composer.json". Then open the composer.json file and fill it with the following data:

{
    "name": "codeigniter4/appstarter",
    "type": "project",
    "description": "CodeIgniter4 starter app",
    "homepage": "https://codeigniter.com",
    "license": "MIT",
    "require": {
        "php": "^7.3 || ^8.0",
        "codeigniter4/framework": "^4"
    },
    "require-dev": {
        "fakerphp/faker": "^1.9",
        "mikey179/vfsstream": "^1.6",
        "phpunit/phpunit": "^9.1"
    },
    "suggest": {
        "ext-fileinfo": "Improves mime type detection for files"
    },
    "autoload": {
        "psr-4": {
            "App\\": "app",
            "Config\\": "app/Config"
        },
        "exclude-from-classmap": [
            "**/Database/Migrations/**"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\Support\\": "tests/_support"
        }
    },
    "scripts": {
        "test": "phpunit"
    },
    "support": {
        "forum": "http://forum.codeigniter.com/",
        "source": "https://github.com/codeigniter4/CodeIgniter4",
        "slack": "https://codeigniterchat.slack.com"
    }
}

After that, you can install composer with the command "composer install" or "composer install --ignore-platform-reqs" and also "composer update". Good luck.

Post a Comment for "Fix PHP Fatal error Uncaught ArgumentCountError array_merge()"