Skip to content

[2.1] [HttpKernel] Add check to Store::unlock to ensure file exists #5375

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

Conversation

jonathaningram
Copy link
Contributor

Bug fix: yes
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes

I was seeing this error in my logs when using an AppCache:

Error 2: /var/www/beta.example.com/shared/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/Store.php line 92: unlink(/var/www/beta.example.com/releases/20120827020525/app/cache/beta/http_cache/md/c2/88/66a911b5266a57bdd55131a47895b8861dfd.lck): No such file or directory

It was only occurring when the http_cache file was being primed (i.e. first load).

I've added a simple check to ensure that the file is a valid file before trying to unlink. I also added a missing @return docblock. Note: I've chosen to return false if the file does not exist as this seems to be the behaviour of the purge method.

Note: this patch is for 2.1/master. I've got a 2.0 one coming in another PR. Wasn't sure the right way to go here because HttpCache component has changed in a few places from 2.0 to 2.1.

@travisbot
Copy link

This pull request passes (merged c28d861 into 9f4525a).

@fabpot
Copy link
Member

fabpot commented Aug 29, 2012

Closing in favor of #5376 (you only need to create a PR on the oldest and maintained branch -- we then merge 2.0 back into master on a regular basis)

@fabpot fabpot closed this Aug 29, 2012
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

Successfully merging this pull request may close these issues.

3 participants