Home > database >  why does this Fatal Error of Codeignitor 4 is hapened?
why does this Fatal Error of Codeignitor 4 is hapened?

Time:12-28

Fatal error: Uncaught TypeError: CodeIgniter\CLI\Console::__construct(): Argument #1 ($app) must be of type CodeIgniter\CodeIgniter, int given, called in C:\xampp\htdocs\edhub-shop-api\spark on line 49 and defined in C:\xampp\htdocs\edhub-shop-api\vendor\codeigniter4\framework\system\CLI\Console.php:29

Fatal error: Uncaught TypeError: CodeIgniter\CLI\Console::__construct(): Argument #1 ($app) must be of type CodeIgniter\CodeIgniter, int given, called in C:\xampp\htdocs\edhub-shop-api\spark on line 49 and defined in C:\xampp\htdocs\edhub-shop-api\vendor\codeigniter4\framework\system\CLI\Console.php:29

CodePudding user response:

This error message indicates that the CodeIgniter\CLI\Console class is being constructed with an invalid argument. Specifically, it is expecting an instance of the CodeIgniter\CodeIgniter class as the first argument, but an integer is being passed instead.

This error can occur if the CodeIgniter\CLI\Console class is being instantiated incorrectly in your code. One possible cause is if the $app variable being passed as an argument is not an instance of the CodeIgniter\CodeIgniter class, but an integer instead.

To fix this error, you should make sure that the $app variable being passed as an argument is an instance of the CodeIgniter\CodeIgniter class. You can do this by checking the type of the $app variable before passing it to the constructor of the CodeIgniter\CLI\Console class.

I hope this helps! Let me know if you have any further questions or need additional assistance.

  • Related