ID: 22362 User updated by: php at codewhore dot org Reported By: php at codewhore dot org -Status: Feedback +Status: Closed Bug Type: Filesystem function related Operating System: Linux 2.4 PHP Version: 4.3.1 Assigned To: wez New Comment:
I just pulled from the PHP_4_3 branch of CVS, and the problem is indeed fixed. Thanks again. :) Previous Comments: ------------------------------------------------------------------------ [2003-02-21 20:46:12] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip Try the next stable snapshot. ------------------------------------------------------------------------ [2003-02-21 19:38:41] php at codewhore dot org Thanks. Glad I could be of (some) help. :) ------------------------------------------------------------------------ [2003-02-21 18:40:52] [EMAIL PROTECTED] Save yourself some energy :) I'm going to look into this this weekend; I know precisely how to fix this, and it most likely not something you would have time to think of by the time I've sorted it out :) I will update this report when it is fixed and you will be able to try the fix using a stable snapshot. Thanks for your efforts so far! ------------------------------------------------------------------------ [2003-02-21 17:44:27] php at codewhore dot org FWIW, the problem also occurs in the following piece of code: <?php $fp = fopen('./foo', 'w+'); fwrite($fp, 'quxbar', 6); fseek($fp, 3, SEEK_SET); fread($fp, 1); fwrite($fp, '!', 1); fseek($fp, 0, SEEK_SET); $buf = fread($fp, 4095); echo "$buf\n"; ?> There's no fseek() between the fread() and fwrite(), so my previous theory seems to be quite wrong. I'll do more digging as time permits... ------------------------------------------------------------------------ [2003-02-21 17:02:51] php at codewhore dot org I'm still mostly lost, but commenting out the following segment of code fixes the problem for the test case. Obviously this isn't the solution, but I think I have it narrowed down to _php_stream_seek thinking that the underlying file position matches the seek offset when it doesn't in reality. PHPAPI int _php_stream_seek(php_stream *stream, off_t offset, int whence TSRMLS_DC) { /* not moving anywhere */ #if 0 if ((offset == 0 && whence == SEEK_CUR) || (offset == stream->position && whence == SEEK_SET)) return 0; #endif ------------------------------------------------------------------------ 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/22362 -- Edit this bug report at http://bugs.php.net/?id=22362&edit=1