Repository navigation
fix(cache): resolve a relative cache path against the project root - #528
Open
etienne-scherrer wants to merge 1 commit into
Open
etienne-scherrer wants to merge 1 commit into
etienne-scherrer wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CacheConfig::path()returnedcache.pathas configured, so a relative path resolved against the working directory. That holds on the CLI, which runs from the project root, but PHP-FPM, CGI and mod_phpchdir()intopublic/before the front controller runs. With the shipped default (storage/cache), the file cache under FPM writes topublic/storage/cache: inside the web root, and usually not writable there. Since #509 every login attempt goes through the cache, so this reaches the defaultmarko/cache-filesetup.A relative
cache.pathnow resolves againstProjectPaths::$base, the wayCacheDirectoryGuardalready resolves the view cache. An absolute path is used as configured.ProjectPathsis an optional constructor argument, so existingnew CacheConfig($repository)calls keep working. The container always injects it, since it resolves class-typed parameters even when they have a default. One test covers that wiring.Found in an app where the login throttle's cache landed in
public/under FPM; the app currently works around it with an absolutecache.path.Type of Change
Related Issues
None; issues are disabled on this repository.
Checklist
./vendor/bin/pest --parallel)./vendor/bin/phpcs)Run locally in a CI-equivalent container (PHP 8.5 with the extensions CI installs, as a non-root user, with an init process):
composer test: 11933 passed, 333 skipped, 0 failed.composer test:integrationagainst Postgres 17, MySQL 8.4 and Redis 7 withMARKO_INTEGRATION_REQUIRED=1: 316 passed, 5 skipped (the MariaDB-only cases); the MySQL suites against MariaDB 11.8 and 10.11: 118 passed each.composer phpstan,phpcs --standard=phpcs.xmlandphp-cs-fixer --dry-run: clean.