Closed olach closed 7 years ago
The issue was that site()->user()
creates a Site
object earlier than expected. Creating a site object loads the configuration. And that's why the custom file is loaded in this stage. Options defined in this custom file are then overwritten again by the stuff that follows after the call to the Site
object.
I have fixed this on the develop branch.
From the forum post.
Normally, when using multi-environment setup we can have a regular
config.php
file and a localconfig.localhost.php
file that can overwrite settings for your local dev setup.This way of overwrite some config values works fine, until you have this code in your
config.php
:If the function
site()->user()
is being run in theconfig.php
, every config setting that is specified afterwards, cannot be overwritten in another local config file likeconfig.localhost.php
.The
site()->user()
is often used to disable the cache if a user is logged in. A quick workaround for this problem is to place this code at the very last end of theconfig.php
file. But the root cause for this should be addressed.