Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Normalize cache file paths #29890

merged 1 commit into from Sep 6, 2019


Copy link

commented Sep 6, 2019

Fixes: #29862

Note: I believe this is an issue in need of fixing with and without the new bootstrap file but has become apparent due to the new file.


You have set a relative path for the cache files using its environment variable, i.e. APP_CONFIG_CACHE.

Assume we have the environment variable set:



In PHPStorm

From their docs:

Custom working directory
... By default, the field is empty and the working directory is the root of the project.

Unfortunately it seems that this is not always the case and people are hitting errors as it is not using the project root as the "base path". I believe PHPStorm is now looking for the config cache file relative to where you run the test, so if you are in the tests/Unit file it is looking for tests/Unit/relative/path.php

There is a manual fix where in PHPStorm's settings you can specify a "Custom working directory" when running tests, but I'm sure everyone would prefer it "just work".

When running tests on the command line from a sub directory.

If you are in a project's root directory and you cd app and then run PHPUnit from this directory with...

$ ../vendor/bin/phpunit -c ../phpunit.xml

it will look for the cache directory in app/relative/path.php.

I believe these are both the same issue just being hit with different tools, i.e. PHPStorm vs PHPUnit.


  1. If no environment variable is set, this PR does not change functionality, i.e.
# no value set, no change in functionality

resolves to BASE_PATH/bootstrap/cache/config.php

  1. If the environment variable is set using an absolute path, this PR does not change functionality, i.e.
# absolute path set, no change in functionality

resolves to /absolute/path/to/file.php

  1. If the environment variable is set using a relative path, this PR does change functionality, i.e.
# relative path set, changes functionality

resolves to BASE_PATH/relative/path/to/file.php

Essentially this PR just enforces a consistent path when specifying a relative path and has the added bonus of fixing the bug I introduced to Laravel 馃憖

@timacdonald timacdonald force-pushed the timacdonald:fix_cache_file_paths branch from 4c00e59 to 723e66e Sep 6, 2019

@timacdonald timacdonald force-pushed the timacdonald:fix_cache_file_paths branch from 723e66e to 7227083 Sep 6, 2019

@taylorotwell taylorotwell merged commit 7227083 into laravel:6.x Sep 6, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can鈥檛 perform that action at this time.