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

Closed
anthonyMyBB opened this Issue Jul 23, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@anthonyMyBB

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.

@nateabele

This comment has been minimized.

Show comment
Hide comment
@nateabele

nateabele Jul 23, 2012

Member

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

Member

nateabele commented Jul 23, 2012

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

@nateabele nateabele closed this Jul 23, 2012

@anthonyMyBB

This comment has been minimized.

Show comment
Hide comment
@anthonyMyBB

anthonyMyBB Jul 24, 2012

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

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

@mehlah

This comment has been minimized.

Show comment
Hide comment
@mehlah

mehlah Jul 31, 2012

Contributor

This should be reopened.
The filter in the default bootstrap/cache.php rely on Environment detection, which is set after.
See https://github.com/UnionOfRAD/framework/blob/master/app/config/bootstrap/cache.php#L44-L60

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.

Contributor

mehlah commented Jul 31, 2012

This should be reopened.
The filter in the default bootstrap/cache.php rely on Environment detection, which is set after.
See https://github.com/UnionOfRAD/framework/blob/master/app/config/bootstrap/cache.php#L44-L60

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 Jul 31, 2012

@nateabele

This comment has been minimized.

Show comment
Hide comment

@nateabele nateabele closed this Sep 15, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment