ID: 27029 Updated by: [EMAIL PROTECTED] Reported By: linke at paralight dot ru -Status: Open +Status: Bogus Bug Type: Filesystem function related Operating System: FreeBSD4.3(ufs) / WinXPpro(ntfs) PHP Version: 4.3.4 New Comment:
Your operating system(s) are reporting the old value because they haven't yet committed the contents --> try using fflush(). If you already have the file opened, use fstat(). Note that (especially under windows), doing anything with a file that is opened by some other process is not guaranteed to give you sane results until some unknown time after the other process has released its handle on the file. Since there is nothing that PHP can do about this, it is not a PHP bug, so setting status to bogus. Previous Comments: ------------------------------------------------------------------------ [2004-01-25 01:16:07] linke at paralight dot ru Are your reading my description well? "When opened file grows during script run, filesize still report old size. Cached filesize? But clearstatcache() before filesize() can't help." I already try clearstatcache()! ------------------------------------------------------------------------ [2004-01-25 00:52:18] [EMAIL PROTECTED] RTFM: Note: The results of this function are cached. See clearstatcache() for more details. ------------------------------------------------------------------------ [2004-01-24 05:02:10] linke at paralight dot ru 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 this bug report at http://bugs.php.net/?id=27029&edit=1