-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
PHP Version
8.4
CodeIgniter4 Version
4.6.4
CodeIgniter4 Installation Method
Manual (zip or tar.gz)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Environment
development
Database
MariaDB 10.4.32
What happened?
I was mistakenly running php spark -environment <env> db:seed without specifying a class name.
Instead of telling me that 'No seeder was specified.' I got a 'The specified seeder is not a valid file: <path/to/project>/<env>.php' error message:
php spark db:seed -environment <env>
CodeIgniter v4.6.4 Command Line Tool - Server Time: 2026-03-17 15:28:55 UTC+01:00
[CodeIgniter\Exceptions\InvalidArgumentException]
The specified seeder is not a valid file: D:\Repos\eportal\app\Database/Seeds/<env>.php
at SYSTEMPATH\Database\Seeder.php:134
Backtrace:
1 SYSTEMPATH\Commands\Database\Seed.php:79
CodeIgniter\Database\Seeder()->call('<env>')
2 SYSTEMPATH\CLI\Commands.php:74
CodeIgniter\Commands\Database\Seed()->run([])
3 SYSTEMPATH\CLI\Console.php:47
CodeIgniter\CLI\Commands()->run('db:seed', [...])
4 SYSTEMPATH\Boot.php:388
CodeIgniter\CLI\Console()->run()
5 ROOTPATH\dako\Boot.php:79
CodeIgniter\Boot::runCommand(Object(CodeIgniter\CLI\Console))
6 ROOTPATH\spark:89
Dako\Boot::bootSpark(Object(Dako\Config\Paths))Steps to Reproduce
Simply run php spark -environment <something> db:seed (argument order does not matter) and compare the expected error message to the actual error message and the backtrace.
Expected Output
'No seeder was specified.'
Anything else?
The issue seems to be located in Seed.php:72 and in Seeder.php:126.
Seed.php performs an array_shift on the params, effectively shifting the specified environment parameter into $seedName, handing it over to $seeder in line 79.
Seeder.php then checks if $class is empty (which it isn't due to the aforementioned shifting) and in turn notices that there is no file like '<path/to/project>/<env>.php' in line 133.
I think a fix could be to either unset the '-environment' parameter in system/CLI/Console.php::run, since the check for the environment parameter is long done by then, or to unset it directly in Seed.php, before the call to array_shift.