Bug #14206 Updated: fputs(); it cuts out any newline codes
| From: | mfischer@php.net | Date: | Sat, 24 Nov 2001 12:10:59 +0000 |
| Subject: | Bug #14206 Updated: fputs(); it cuts out any newline codes | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71522@lists.php.net to get a copy of this message | ||
ID: 14206
Updated by: mfischer
Reported By: dstankewitz@dragonsphere.de
Old Status: Open
Status: Feedback
Bug Type: Filesystem function related
Operating System: Linux 2.2.19
PHP Version: 4.0.6
New Comment:
Can't reproduce this with 4.0.6 CGI und current CVS version.
Please provide a independent runnning script with its own input data (i.e. so its for the testers
just a matter of copy&paste and run).
If in doubt also try latest RC from
http://www.php.net/~zeev/php-4.1.0RC3.tar.gz
Feedback.
Previous Comments:
------------------------------------------------------------------------
[2001-11-24 06:24:38] dstankewitz@dragonsphere.de
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 this bug report at http://bugs.php.net/?id=14206&edit=1