-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Fatal error when trying to define constants based on the environment #9387
Comments
Try as |
I got : |
You can register more constants on per-config files (production.php, development.php, testing.php) under Boot directory that verify based environment used https://github.com/codeigniter4/CodeIgniter4/tree/develop/app/Config/Boot |
Closing as answered above #9387 (comment) |
PHP Version
8.3
CodeIgniter4 Version
4.5.7
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
I would like to define some constants based on my environment but this give me a Fatal error because 'ENVIRONMENT' is not defined.
Constants are loaded before the environment as you can see in
Boot.php
L131-132CodeIgniter4/system/Boot.php
Lines 128 to 136 in dd08f95
Is this an expected design? Can we load constants after environment setup?
Steps to Reproduce
Add condition like
if (ENVIRONMENT === 'development') { define('A', expr); } else { define('B', expr); }
in Config/Constants.phpExpected Output
I would like my constant to be defined according to the environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: