On Fri, Sep 3, 2021 at 4:24 PM Nikita Popov <nikita....@gmail.com> wrote: > Just to throw it out there: Maybe we should clear the stat cache when > functions in the exec family are used? Even if we allow disabling the stat > cache, I think we can easily avoid that particular footgun. And if calls to > external binaries are involved we likely don't have to worry about stat > overhead.
This code also breaks: <?php $testfile= 'bug28790.write.out'; function print_stat($filename) { $s = @stat($filename); echo "$filename: ".$s['size']."\n"; } $f = fopen($testfile, "a"); print_stat($testfile); fwrite($f, "five\n"); print_stat($testfile); fclose($f); So you'd need to add fwrite and a number of other functions to the ones managing this cache. And after all that, external programs (or forked children) can ruin your day. One could argue that making a bug more arcane is a form of cruelty. Kevin -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php