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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] \Cache->exists() returns always bool(false) when DSN is folder #368

Open
jyri78 opened this issue Oct 24, 2023 · 1 comment
Open

Comments

@jyri78
Copy link

jyri78 commented Oct 24, 2023

I'm working on tiny project and noticed, that caching seems not working. Cache file is created, but later not found anymore.
Looking at Fat-Free Core source I noticed, that in function set() slashes and backshashes will be stripped, but not in exists() and neither clear(). That can lead to bug, when $key contains slashes/backslashes.

@jyri78 jyri78 changed the title Bug: \Cache->exists() returns always bool(false) when DSN is folder [Bug] \Cache->exists() returns always bool(false) when DSN is folder Oct 24, 2023
@BrewCurious
Copy link
Contributor

I found the same thing happening on my local development environment. There are several places in the base.php file that use is_file or read and write methods where the incoming filename string to be checked should be passed to the fixslashes method first.

For the purposes of this specific issue, however, I've submitted a PR with just the cache get method being modified to filter the incoming key in the same way that it is being written via the set method. PR #369 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants