3 ms·
Maybe I didn't understand this article properly, but is it suggesting suppressing ALL filesystem related errors rather than handling them properly? OK I get th
by samarudge 14y ago
Maybe I didn't understand this article properly, but is it suggesting suppressing ALL filesystem related errors rather than handling them properly?
OK I get that PHP doesn't support atomic operations, but there are so many different errors that could happen when working with files. Say a permissions error, if the permissions of the file were changed between it being created and deleted that's an issue that needs resolving before your tmp folder fills up, it's easy enough to fix and should be reported as an error (be it to the front-end or to a backend logging service).
Surely there is a better way to handle these race conditions without just ignoring all filesystem related errors.
- RossM 14y agoNo, I think the author knows the issues behind this muting - you just need to be smart about how you apply it. In the case of filemtime, it appears the only failure condition is a file not existing so we can safely ignore the E_WARNING it emits; it wouldn't be sensible to apply this everywhere (I hadn't thought about the permissions case myself). The best/real solution is probably implementing flock so that it can issue real filesystem locks, rather than relying on a file resource.