#23406 [Opn]: \r\n not functioning the same from 4.3.1 and prior

From: Date: Tue, 29 Apr 2003 21:34:35 +0000
Subject: #23406 [Opn]: \r\n not functioning the same from 4.3.1 and prior
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38771@lists.php.net to get a copy of this message
ID: 23406 User updated by: gfraley5 at earthlink dot net Reported By: gfraley5 at earthlink dot net Status: Open Bug Type: Filesystem function related Operating System: Win98SE,WinXP,Win2K PHP Version: 4.3.2RC2 New Comment: It works _perfectly_ under 4.2.3 WITHOUT using 'wb', just like 4.3.1! That's the problem :(. I always upgrade before the finals are released and it has always worked as just 'w'. Not only that, and hold on here, but the windows version has NEVER required \r\n. It always works with \n but that's a whole 'nother issue :) Previous Comments: ------------------------------------------------------------------------ [2003-04-29 16:02:19] michael dot mauch at gmx dot de <http://www.php.net/downloads.php> (scroll down to where it says "PHP 4.2.3"). ------------------------------------------------------------------------ [2003-04-29 14:24:35] gfraley5 at earthlink dot net Where can I get the older version? ------------------------------------------------------------------------ [2003-04-29 09:34:19] wez@php.net The curious thing is that PHP doesn't treat the line endings specially itself. Can you try this with 4.2.3 (NOT 4.3.2!)? It's more likely that this was a bug in 4.3.0/4.3.1 that has been fixed; I do want to get to the bottom of it though. In general, it is always a good idea to use the 'b' flag in your fopen calls if you are planning to write canonical line endings, as windows does strange things with line endings on text-mode file handles. ------------------------------------------------------------------------ [2003-04-29 09:27:02] gfraley5 at earthlink dot net Adding the 'wb' corrects the problem. But, and here is the most important issue, the behavior HAS changed from 4.3.1 and prior to 4.3.2 and it definitely breaks and renders useless the file that it writes out, based on how the input routines then read that file in 4.3.1 and prior. If you use \n instead of \r\n you have the same issue except the you don't get the line feed extra line. I did check the actual line endings and they are different and the byte count is different also. My ini settings have not changed. Can you explain why this change in behaviour has been made? Thanks. ------------------------------------------------------------------------ [2003-04-29 09:12:05] wez@php.net fopen("problemFile.php",'wb') Does that help? Also, check the line endings in the actual file (not in the output generated by php), and your auto_detect_line_endings ini setting. ------------------------------------------------------------------------ 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/23406 -- Edit this bug report at http://bugs.php.net/?id=23406&edit=1

« previous php.bugs (#38771) next »