From:             phpbug at lapage dot com
Operating system: Win98
PHP version:      4.3.2
PHP Bug Type:     Output Control
Bug description:  fopen text-mode does not play nicely with heredoc

Description:
------------
Writing in text-mode does not play nicely with heredoc, in Win32.  Line
endings become \r\r\n in the typical situation: php source code with \r\n
endings.

This will break, for example, batch files written for Win98.

Reproduce code:
---------------
$fp= fopen('file.txt', 'wt');
fwrite($fp, <<<ENDTEXT
One line of text
Another line of text
Last line of text\n
ENDTEXT
);
fclose($fp);


Expected result:
----------------
One line of text\r\n
Another line of text\r\n
Last line of text\r\n


Actual result:
--------------
One line of text\r\r\n
Another line of text\r\r\n
Last line of text\r\n

-- 
Edit bug report at http://bugs.php.net/?id=26427&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26427&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26427&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26427&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26427&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26427&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26427&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26427&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26427&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26427&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26427&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26427&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26427&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26427&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26427&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26427&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26427&r=float

Reply via email to