Skip to content

Bug: Spark cannot use Сommand option on PHP 7.4 (Cannot unpack array with string keys) #5835

@iRedds

Description

@iRedds

PHP Version

7.4

CodeIgniter4 Version

dev

CodeIgniter4 Installation Method

Git

Which operating systems have you tested for this bug?

Windows

Which server did you use?

cli

Database

No response

What happened?

[Error]

Cannot unpack array with string keys

at SYSTEMPATH\CodeIgniter.php:893

Backtrace:
  1    SYSTEMPATH\CodeIgniter.php:467
       CodeIgniter\CodeIgniter()->runController()

  2    SYSTEMPATH\CodeIgniter.php:346
       CodeIgniter\CodeIgniter()->handleRequest()

  3    SYSTEMPATH\CLI\Console.php:48
       CodeIgniter\CodeIgniter()->run()

  4    ROOTPATH\spark:79
       CodeIgniter\CLI\Console()->run()


Process finished with exit code 9.

Steps to Reproduce

php.exe spark make:migration a --table

Anything else?

  1. Adds options to the list of arguments.

    $this->args[$arg] = $value;

    We unpack the array [0 => 'make:migration', 1 => 'a' 'table' => null], which causes an exception.
    $output = method_exists($class, '_remap')
    ? $class->_remap($this->method, ...$params)
    : $class->{$this->method}(...$params);

  2. The console command tests use the command() function call, which differs in functionality from calling a command in the console via spark.
    I think that command call tests should be supplemented with a test that simulates calling a command in the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions