Skip to content

Commit b2adb88

Browse files
committed
Use segments instead of route for CLI params
1 parent 30b02c6 commit b2adb88

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

system/CodeIgniter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,13 +838,18 @@ protected function createController()
838838
*/
839839
protected function runController($class)
840840
{
841+
// If this is a CLI request then use the input segments as parameters
842+
$params = (is_cli() && ! (ENVIRONMENT === 'testing'))
843+
? $this->request->getSegments()
844+
: $this->router->params();
845+
841846
if (method_exists($class, '_remap'))
842847
{
843-
$output = $class->_remap($this->method, ...$this->router->params());
848+
$output = $class->_remap($this->method, ...$params);
844849
}
845850
else
846851
{
847-
$output = $class->{$this->method}(...$this->router->params());
852+
$output = $class->{$this->method}(...$params);
848853
}
849854

850855
$this->benchmark->stop('controller');

0 commit comments

Comments
 (0)