Describe the bug
- When controllers run via CLI, they can't get param data properly
- CLI commands can't get param data properly
e.g.
- input
abc < def → param abc
- input
McDonald's → param McDonald's
- input
<s>aaa</s> → param aaa
Related #5263
CodeIgniter 4 version
develop after 4.1.4
Affected module(s)
CLIRequest
Expected behavior, and steps to reproduce if appropriate
Controller
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
class Test extends Controller
{
public function run($param = '')
{
var_dump($param);
}
}
$ php public/index.php test run 'abc < def'
string(4) "abc "
$ php public/index.php test run "McDonald's"
string(14) "McDonald's"
$ php public/index.php test run '<s>aaa</s>'
string(3) "aaa"
Command
<?php
namespace App\Commands;
use CodeIgniter\CLI\BaseCommand;
class Test extends BaseCommand
{
protected $group = 'tests';
protected $name = 'test';
protected $description = 'Just testing.';
public function run(array $params)
{
var_dump($params);
}
}
$ php spark test 'abc < def'
CodeIgniter v4.1.4 Command Line Tool - Server Time: 2021-10-31 21:15:20 UTC-05:00
array(1) {
[0] =>
string(4) "abc "
}
$ php spark test "McDonald's"
CodeIgniter v4.1.4 Command Line Tool - Server Time: 2021-10-31 21:15:30 UTC-05:00
array(1) {
[0] =>
string(14) "McDonald's"
}
$ php spark test '<s>aaa</s>'
CodeIgniter v4.1.4 Command Line Tool - Server Time: 2021-10-31 21:15:39 UTC-05:00
array(1) {
[0] =>
string(3) "aaa"
}
Context
- OS: [macOS 10.15.7]
- Web server [n/a]
- PHP version [8.0.12]
- Database: [n/a]
Describe the bug
e.g.
abc < def→ paramabcMcDonald's→ paramMcDonald's<s>aaa</s>→ paramaaaRelated #5263
CodeIgniter 4 version
developafter 4.1.4Affected module(s)
CLIRequest
Expected behavior, and steps to reproduce if appropriate
Controller
Command
Context