Skip to content


Incorrect Environment::is() in bootstrap/cache.php #595

anthonyMyBB opened this Issue · 4 comments

3 participants


I notice that doing an Environment::is('development') in the filter of cache.php returns false even if I'm in a development context (this was checked with a call of Environment::is('development') in a controller).

The reason is that the file cache.php in included before action.php.

Union of RAD member

Right, that's why you shouldn't write code that's dependent on the environment in the bootstrap.

@nateabele nateabele closed this

Ok, so why there is some code that depends on the environment in the framework/app/config/bootstrap/cache.php ?

Anyway I think this code is necessary to disable cache on production environment. And the code is in a filter so it can work just by switching the action.php include and cache.php include


This should be reopened.
The filter in the default bootstrap/cache.php rely on Environment detection, which is set after.

I see a lot of guys starting with Lithium in IRC, being confused about why their test class or custom Form helper that doesn't show up.
That was caused by the .core.libraries cache file.

To avoid writing heavy code depending on the environment everywhere in the bootstrap, why not clarifying things by adding a environment.php file in the bootstrap, where hooks are set depending on environments.

@nateabele nateabele reopened this
Union of RAD member
@nateabele nateabele closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.