Welcome Guest, Not a member yet? Register   Sign In
Error: Use of undefined constant ENVIRONMENT - CI 4.1.5
#1

(This post was last modified: 11-20-2021, 06:56 PM by Mobostar.)

Hello,
I am getting this error when I run "spark" to create a migration.
Code:
$ php spark migrate:create create_posts_table
PHP Warning:  Use of undefined constant ENVIRONMENT - assumed 'ENVIRONMENT' (this will throw an Error in a future version of PHP) in vendor/codeigniter4/framework/system/Config/Factories.php on line 110

The migration is created anyway, but I wonder what this is about.

PHP 7.4.3
CI 4.1.5

Thanks
Reply
#2

(This post was last modified: 11-20-2021, 07:31 PM by kenjis.)

I can't reproduce it.

See vendor/codeigniter4/framework/system/Config/Factories.php line 110.
Reply
#3

The following is the "PHP stack trace" for the same error in case it helps.

Code:
PHP Stack trace:
PHP  1. {main}() /var/www/xyz.com/spark:0
PHP  2. require() /var/www/xyz.com/spark:44
PHP  3. CodeIgniter\Config\Services::codeigniter() /var/www/xyz.com/vendor/codeigniter4/framework/system/bootstrap.php:145
PHP  4. CodeIgniter\Config\BaseService::getSharedInstance() /var/www/xyz.com/vendor/codeigniter4/framework/system/Config/Services.php:134
PHP  5. CodeIgniter\Config\Services::codeigniter() /var/www/xyz.com/vendor/codeigniter4/framework/system/Config/BaseService.php:189
PHP  6. config() /var/www/xyz.com/vendor/codeigniter4/framework/system/Config/Services.php:137
PHP  7. CodeIgniter\Config\Factories::config() /var/www/xyz.com/vendor/codeigniter4/framework/system/Common.php:198
PHP  8. CodeIgniter\Config\Factories::__callStatic() /var/www/xyz.com/vendor/codeigniter4/framework/system/Common.php:198
Reply
#4

Line 110 of Factories.php is:
self::$instances[$options['component']][$class] = new $class(...$arguments);

I believe there is something messed up with your installation.
Simpler is always better
Reply
#5

I did a fresh CI4 installation via Composer and that error disappeared.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB