ID: 22682 Updated by: [EMAIL PROTECTED] Reported By: fbeyer at clickhand dot de -Status: Analyzed +Status: Feedback Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 4CVS-2003-04-28 (stable) New Comment:
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 Previous Comments: ------------------------------------------------------------------------ [2003-05-11 08:28:04] [EMAIL PROTECTED] As Wez pointed out above, this is a generic __setmode() issue. status: open => verified ------------------------------------------------------------------------ [2003-04-28 12:31:38] [EMAIL PROTECTED] Related to Bug #22497 ------------------------------------------------------------------------ [2003-04-28 09:18:51] fbeyer at clickhand dot de No, unfortunately, the result is the same. But I've found out that the problem only occurs if PHP is run as an apache module (I'm currently using 1.3.20). The CGI executable works as expected - this is why I mentioned that the bug doesn't occur in the PHP5 snapshot since I've installed it using CGI. ------------------------------------------------------------------------ [2003-04-23 05:00:26] [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 ------------------------------------------------------------------------ [2003-03-13 11:41:40] fbeyer at clickhand dot de I have found this bug in 4.3.0, searched matching bug reports and they said the bug is fixed in the latest stable CVS snap. I have downloaded and installed today's latest version, the fix is mentioned in the news.txt, but the bug is still there. Here are my test files for a short reproducing script: file test.txt: (saved in dos format, ie. newlines are CRLF/\r\n): ------------------------------ This is a test file in win32 / dos format ie. lines end with CRLF resp. \r\n ------------------------------ file test.php ------------------------------ <?php $fp = fopen('test.txt', 'r'); $contents = fread($fp, 30); fseek($fp, ftell($fp)); $contents .= fread($fp, 30); echo $contents; echo "\n\n"; var_dump(strpos($contents, "\r")); ?> ------------------------------ Output: ------------------------------ This is a test file in win32 // dos format ie. lines end wit bool(false) ------------------------------ It can be seen that fseek() or ftell() don't work as expected: the '/' character is read twice. Furthermore, fread() doesn't return \r characters. I also have tested this for fgetc() - \r is not read. A strange thing is that this bug doesn't occurr in the newest php5/ze2 snapshot. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22682&edit=1
