From: linke at paralight dot ru Operating system: FreeBSD4.3(ufs) / WinXPpro(ntfs) PHP version: 4.3.4 PHP Bug Type: Filesystem function related Bug description: filesize() during concurrent file read/write
Description: ------------ When opened file grows during script run, filesize still report old size. Cached filesize? But clearstatcache() before filesize() can't help. On FreeBSD 4.3-STABLE there is no this unexpected behaviour - it's all ok without any clearstatcache(); I get my "bbbbbb" on WindowsXP/ntfs when when I use fread($fd_2, 1024) instead of fread($fd_2, filesize('test')). In production environment i'll get this behavior during concurrent file read/write from two simultaneously running script. I think at leas this behavior must be same at all platforms, so it's a bug. Reproduce code: --------------- <? $fd=fopen('test', 'wb'); fwrite($fd, 'aa'); fclose($fd); $fd_1=fopen('test', 'rb+'); $fd_2=fopen('test', 'rb+'); fwrite($fd_1, 'bbbbbb'); echo fread($fd_2, filesize('test')); fclose($fd_1); fclose($fd_2); ?> Expected result: ---------------- bbbbbb Actual result: -------------- FreeBSD 4.3-STABLE (ufs): bbbbbb Windows XP pro (ntfs): bb -- Edit bug report at http://bugs.php.net/?id=27029&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27029&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27029&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27029&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27029&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27029&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27029&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27029&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27029&r=support Expected behavior: http://bugs.php.net/fix.php?id=27029&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27029&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27029&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27029&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27029&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27029&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27029&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27029&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27029&r=float