ID: 21087 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Critical Bug Type: Filesystem function related Operating System: XP PHP Version: 4.3.0RC3 New Comment:
Just a further note. It also/still errors on RC4. Also, if you use flock($fp,2) instead of flock($fp,1) it works. Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2002-12-19 21:21:56] [EMAIL PROTECTED] It appears to be the flock() call. This fails. However, if you comment out the flock() calls it works. $filename = "c:/phptest.txt"; $data = "This is test text"; $fp = fopen("$filename",'w'); flock($fp,1); $len = fwrite($fp,$data); flock($fp,3); fclose($fp); echo "Wrote $len bytes"; ------------------------------------------------------------------------ [2002-12-19 11:27:09] [EMAIL PROTECTED] Keep this at feedback. (and note that I am not [EMAIL PROTECTED] and that my previous comment on this was my first). ------------------------------------------------------------------------ [2002-12-19 11:17:24] [EMAIL PROTECTED] Sorry for the misunderstanding. First of all I did not know that you were a developer working the problem. Nothing in your comment told me that. Secondly, I have already stated that I will try to produce a smaller script (see my original post). I just haven't had time to work the problem. As to the buffering, without it, the full text is not written out. It gets truncated. ------------------------------------------------------------------------ [2002-12-19 07:43:14] [EMAIL PROTECTED] Please try and cut down the script to a complete self-contained example that I can run here. I'm not going to spend hours debugging a long, incomplete code fragment. What I'm looking for it something like this: $fp = fopen($filename, "w"); $len = fwrite($fp, $data); fclose($fp); echo "Wrote $len bytes"; If that works, try adding in the flock calls. If that works, try adding in those set_file_buffer calls (NB: there does not seem to be a need to play with file buffering in this case). Please help me to help you. ------------------------------------------------------------------------ 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