On Fri, Sep 3, 2021 at 2:34 PM Christian Schneider
<cschn...@cschneid.com> wrote:
> If I remember correctly it was about reducing the number of system calls. Is 
> this no issue any more?
> Has a quick benchmark been done to see the positive / negative impact of the 
> stat cache for a typical application?

In the lifespan of php it really wasn't an issue unless someone was
doing something that wasn't wise - I can't think of a single reason to
stat a file in a tight loop.

However more importantly the current behaviour returns bad data for
perfectly correct programs. So for example on a unix box...

<?php
passthru('touch foo');
if (is_file('foo')) {
    echo "Correct\n";
}
passthru('rm foo');
if (is_file('foo')) {
    echo "Incorrect\n";
}
?>

Now this is a silly toy, but imagine using is_file to see if a
graphics file exists, running an image processing program on it to
modify it, and then using a stat call to get the file length to
populate the Content-Length field - it will almost certainly be wrong.

Personally I value correctness first and then performance is a
priority further down that list of attributes (security and
readability would also be higher priorities). However as the current
behaviour has existed for several decades, this change makes sure the
incorrect historical behaviour is the default.

Kevin

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to