ID: 21087 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Filesystem function related Operating System: XP PHP Version: 4.3.0RC3 New Comment:
I can't explain the sudden change in behaviour either. The entire filesystem IO layer was rewritten since 4.2, but AFAICT, the same functions are called in 4.2 as are being called in 4.3, in the same order. The only difference is that 4.3 prefers to use fd's rather than FILE*'s, but in my tests here, using the FILE* gave the same error. *shrug* Previous Comments: ------------------------------------------------------------------------ [2002-12-22 09:09:34] [EMAIL PROTECTED] I am so sorry, but why does it [appear to] work under previous releases and only breaks under 4.3.0RC's? have you tightened up the code? ------------------------------------------------------------------------ [2002-12-22 08:51:35] [EMAIL PROTECTED] Your script is broken :) It's taken a few hours for us to realize this and it's pretty easy to overlook. You are locking the file for shared access and then writing to it. This doesn't make sense, because you should really be using an exclusive lock (LOCK_EX) to do this. Under unix systems, flock is an advisory lock, meaning that processes can ignore the lock status if they wish. Under windows, the locking is enforced by the OS which forbids the write access, hence the zero-size file. Additionally, the win32 docs state that closing a file that was locked (but not unlocked) leads to undefined behaviour, so that flock($fp, LOCK_UN) call *is* required for win32. ------------------------------------------------------------------------ [2002-12-22 08:05:42] [EMAIL PROTECTED] Update summary. LOCK_EX works fine. Additionally, writing to the file prior to obtaining the lock also works fine, but defeats the purpose of the lock. ------------------------------------------------------------------------ [2002-12-21 18:41:37] [EMAIL PROTECTED] Just a further note. It also/still errors on RC4. Also, if you use flock($fp,2) instead of flock($fp,1) it works. ------------------------------------------------------------------------ [2002-12-19 22:27:29] [EMAIL PROTECTED] Small note, the 2nd flock (flock($fp,3);) is entirely optional. The problem is occures if prior to write the LOCK_SH is set on the file, the problem does not happen if LOCK_EX is used. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/21087 -- Edit this bug report at http://bugs.php.net/?id=21087&edit=1