-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Cache::put() throws a warning if the directory already exists #2518
Comments
The Laravel framework converts all PHP errors to Exceptions, so it will be catched by the catch block. This is a recent change (to circumvent a race condition) and before, it was in an if-statement checking for existence of the directory. |
Hmm that is interesting, thanks for the info @JoostK. So how interested are we in making these various components work on their own? My impression was that that was the nice thing about separating the core out into distinct packages. I can set up service providers to handle various inter-package dependencies, but this one is a bit tougher. I will probably end up converting warnings to exceptions (where is the code that does that, btw?), but it may not be the best solution for everyone. |
I searched for the issue, it's #2379, and the commit was 4841dc8. @robclancy is having the same issue and I agree this is important to fix; the separation of packages is actually mainly to use them on their own. |
Nice find, @JoostK. I'm guessing the best way to fix this issue is to just undo that change, but I'll leave that to @taylorotwell |
I'll look into fixing this. |
For the record you can revert to using the 4.0.7 package for now and it will work fine as long as your project doesn't have massive amounts of hits and cause the race condition. |
Fixed. |
Thanks, @taylorotwell! The fixing commit is here for future reference: 7bf5871 |
Due to my inability to convert a work project over to Laravel entirely, I've decided to use pieces of Illuminate in a CodeIgniter project. This has (as expected) worked wonderfully, but I seem to be running into a little problem with the cache file store. Consider this bit of code in the FileStore.php class (i.e. the
put()
andcreateCacheDirectory()
methods:The first time this runs, it will create the
application/cache/ac/bd/
directory (whereac
andbd
are the first bits of the md5 hash for the cache key) without any problems. However, once the cache expires (as it would, for example, when runningCache::remember()
) and the file is deleted, or just when you callCache::put()
twice, you get this warning:I'm getting this issue in both Windows and Linux environments.
So I'm curious if this is expected behavior. Why would this only be happening outside of the Laravel context? What might I do to avoid this issue?
Thanks!
The text was updated successfully, but these errors were encountered: