Bug #14206: fputs(); it cuts out any newline codes
| From: | dstankewitz at dragonsphere dot de | Date: | Sat, 24 Nov 2001 11:24:39 +0000 |
| Subject: | Bug #14206: fputs(); it cuts out any newline codes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-71520@lists.php.net to get a copy of this message | ||
From: dstankewitz@dragonsphere.de
Operating system: Linux 2.2.19
PHP version: 4.0.6
PHP Bug Type: Filesystem function related
Bug description: fputs(); it cuts out any newline codes
Hi,
i just found a very strange bug. Im using something like this in a class:
function csv_Append ($file, $elements, $separator = ';') {
$fp = fopen($file, 'a');
if (!$locked = flock($fp, LOCK_EX)) return false;
$out = implode($separator, $elements)."\n";
fputs($fp, $out);
flock($fp, LOCK_UN);
fclose($fp);
return true;
} //-- end function
When using this function fputs() cuts out all escaped codes like \n \r \t
.... even if i try to write it directly (chr(13)) and i check the file with
a hex editor the is no 0A byte... but fputs reports it has written one
byte (returns 1) ...
--
Edit bug report at: http://bugs.php.net/?id=14206&edit=1