fix: Tolerate a directory removed by a parallel request in Dir - #8511
distantnative wants to merge 2 commits into
Conversation
e7df8e4 to
f40c42b
Compare
afbora
left a comment
There was a problem hiding this comment.
@scandir() works, but it suppresses every warning from that call, not just the missing directory. I tested it: permission, not-a-directory, open file limits, all silenced, and Whoops stays quiet too since it checks the error_reporting mask. So if the dir is still there and the scan fails for another reason, we silently return empty. Maybe throw instead:
if ($items === false) {
if (is_dir($dir) === true) {
throw new Exception('The directory "' . $dir . '" could not be read');
}
return [];
}Fine to approve as is though 👍
|
@afbora Wouldn't those what you describe already fail on the |
|
@distantnative Not all of them. Tested on Windows: removed the read permission from a directory and |
|
@afbora What do you think about using |
8464a60 to
0717c4e
Compare
|
@distantnative I know new cases popping up isn't great, but returning |
Review
Description
Dir::read()andDir::removeRecursive()both check that a directory exists and thenscandir()it. A parallel request can remove it in between, and the warning surfaces as anErrorException.Both now treat a failed scan as "already empty".
Probably a bit esoteric, but came up in the pressure tests against #8469.
Changelog
🐛 Bug fixes
For review team