| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2019-02-10 21:29 UTC] krakjoe@php.net
 
-Status: Open
+Status: Not a bug
  [2019-02-10 21:29 UTC] krakjoe@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 02:00:01 2025 UTC | 
Description: ------------ other processes are denied to write the file while it is shared-locked, but attempting to do so prevents filesize() from working Test script: --------------- <?php // create a file of 6 bytes $path = __DIR__ . "/foo.txt"; file_put_contents($path, "123456"); // (1) // open that file for read and shared-lock it $file = fopen($path, "r"); flock($file, LOCK_SH | LOCK_NB); // (2) // attempt to write that file concurrently while the lock is active echo `php -r "file_put_contents('$path', 'baz');"`; // this step fails as expected -- means the file is still "123456" // (3) // attempt to read the file's size clearstatcache(FALSE, $path); $fileSize = filesize($path); // should return 6 bytes but returns 0 // (4) // this fails as consequence echo $fileSize . "\n"; echo fread($file, $fileSize); flock($file, LOCK_UN); fclose($file); Expected result: ---------------- should work as if the step (2) was commented out