#23406 [Opn->Fbk]: \r\n not functioning the same from 4.3.1 and prior
| From: | wez@php.net | Date: | Tue, 29 Apr 2003 14:12:05 +0000 |
| Subject: | #23406 [Opn->Fbk]: \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-38713@lists.php.net to get a copy of this message | ||
ID: 23406
Updated by: wez@php.net
Reported By: gfraley5 at earthlink dot net
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: Win98SE,WinXP,Win2K
PHP Version: 4.3.2RC2
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2003-04-29 08:03:35] gfraley5 at earthlink dot net
This code snippet demonstrates the problem. Under 4.3.1 and prior, it
functions correctly. Under 4.3.2 (all versions) it does not function
the same and is actually wrong.
<?
$myArray[] = 'msgid'."\r\n";
$myArray[] = '1049987091'."\r\n";
$myArray[] = '1050930128'."\r\n";
$fp = fopen("problemFile.php",'w') or die("Unable to open file");
for ($i=0;$i<count($myArray);$i++) {
if ($i==0) $prefx = "<? Header(\"HTTP/1.0 403
Forbidden\");exit;?>\r\n";
else $prefx = "";
fwrite($fp,$prefx.$myArray[$i]);
}
fclose($fp);
echo nl2br(readfile("problemFile.php"));
?>
Under 4.3.1 and prior, here is the output of problemFile.php:
<? Header("HTTP/1.0 403 Forbidden");exit;?>
msgid
1049987091
1050930128
Under 4.3.2, here is the output of problemFile.php. Notice the
difference in the behaviour of the \r\n:
<? Header("HTTP/1.0 403 Forbidden");exit;?>
msgid
1049987091
1050930128
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23406&edit=1