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

Check if cached file exists #1866

Closed
wants to merge 2 commits into from
Closed

Check if cached file exists #1866

wants to merge 2 commits into from

Conversation

torzech
Copy link
Contributor

@torzech torzech commented Oct 9, 2015

Without this modification:

Array
(
    [code] => 2
    [message] => filemtime(): stat failed for /Users/torzech/code/[---cut---]/app/cache/6/9/69b8b36648330d23ccfb6e8b7542e0dbdd518a910ab986d602639e1b855de522.php
    [file] => /Users/torzech/code/[---cut---]/libs/twig/twig/lib/Twig/Cache/Filesystem.php
    [line] => 91
)

@SpacePossum
Copy link
Contributor

@stof
Copy link
Member

stof commented Oct 9, 2015

@fabpot I think I know why so many people report this: the Symfony Debug component is still logging silenced errors by default in the dev env

@Tobion
Copy link
Contributor

Tobion commented Oct 9, 2015

@stof yes that is what I said in #1848

The only "annoying" thing I noticed is, when you remove the cache and then run your app, all those non-existing template caches are reported as "silenced errors" from the symfony profiler whenever the template cache doesn't exist yet.

@@ -87,6 +87,10 @@ public function write($key, $content)
*/
public function getTimestamp($key)
{
return (int) @filemtime($key);
if (\file_exists($key)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backslash is not necessary before a global function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should indeed be removed for 5.2 compat.

@fabpot
Copy link
Contributor

fabpot commented Oct 10, 2015

So, the fix should be done in Symfony instead, right?

@Tobion
Copy link
Contributor

Tobion commented Oct 12, 2015

@fabpot no symfony cannot do anything about it. IMO this change here is valid (apart from the CS) as it avoids alot of warning spams.

@fabpot
Copy link
Contributor

fabpot commented Oct 12, 2015

Thank you @torzech.

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

Successfully merging this pull request may close these issues.

6 participants