php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20215 fputs(); (Line Feed / Carriage Return)
Submitted: 2002-11-01 16:05 UTC Modified: 2003-02-25 02:04 UTC
Votes:8
Avg. Score:3.5 ± 1.4
Reproduced:3 of 4 (75.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: admin at serveurperso dot com Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.1-dev OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
47 + 36 = ?
Subscribe to this entry?

 
 [2002-11-01 16:05 UTC] admin at serveurperso dot com
To every writings the function "fput" adds jumps of lines in too much.

Sample script :
------------------------------------------------
<FORM ACTION = "?save=1" METHOD = "post">
 <TEXTAREA NAME = "contenu" ROWS="10" COLS="40">
<?
 $fichier = "fichier.txt";
 if($save) {
  $fp = fopen($fichier, "w");
  fputs($fp, stripslashes($contenu));
  fclose($fp);
 }
 readfile($fichier);
?>
 </TEXTAREA><BR>
 <INPUT TYPE = "submit" VALUE = "Enregistrer">
</FORM>
------------------------------------------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-16 17:08 UTC] wez@php.net
I can't reproduce the problem using PHP 4.3RC1 or the slightly more up to date PHP 4.3 development branch and
the script that you provided, either under win XP with IIS
or linux.

I'm using php.ini-recommended, so please make sure that
you don't have any zany settings turned on in your php.ini or server configuration.

 [2002-11-26 17:09 UTC] admin at serveurperso dot com
I meet the problem with - Windows 2000 Pro SP3 (FAT32) - Apache 1.3.27 - PHP 4.3RC1 *with php.ini-recommended*
(http://www.serveurperso.com/php.ini)
This small script bug (mini notepad for admin-zone...)
http://www.serveurperso.com/temp/fputs.php
! The bug with PhpMyExplorer text file editor is the same.
Is it can be an Apache problem in the interpretation of the form?
 [2002-11-27 06:09 UTC] wez@php.net
Can you provide a link that will allow me to download the .txt and .php files directly?
(or zip them up and mail them to me)
 [2002-11-27 13:22 UTC] admin at serveurperso dot com
I had foreseen what it is necessary since the beginning on:
http://www.serveurperso.com/temp (fichier.txt and copy-paste from the show_source("fputs.php");)

I send "fputs.php" script and "fichier.txt" sample text file to you (wez@php.net) to make win you of the time.

I don't arrive determined of or come these 0D0A(hex) in too much. It doubles has every writings.

(I am French sorry for my english)
 [2003-02-09 10:53 UTC] moriyoshi@php.net
Similar to bug #21916
 [2003-02-11 15:40 UTC] 6th at katiusha dot com dot ru
PHP 4.3.0 (build Dec 27 2002)
Apache 1.3.23
Win ME

This:

$f=fopen("bug","w");
fwrite($f,"test
"); // 74 65 73 74 _0D 0A_
fclose($f);

creates file:

74 65 73 74 _0D 0D 0A_

I'm using plain files with ms-dos line breaks to store databases, so fwrite is _very_ important for me to work correctly.
 [2003-02-11 15:57 UTC] 6th at katiusha dot com dot ru
Funnily, 
the bug occurs when I run php as a module. When I run php using cgi or commandline, no excess 0D symbols appear.
 [2003-02-19 19:39 UTC] sniper@php.net
What if you write the file in 'wb' (binary) mode? Does
it make any difference? 

 [2003-02-25 02:04 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2007-07-18 07:01 UTC] mufd2002 at hotmail dot com
I can't reproduce the problem using PHP 4.3RC1 or the slightly more up
to date PHP 4.3 development branch and
the script that you provided, either under win XP with IIS
or linux.

I'm using php.ini-recommended, so please make sure that
you don't have any zany settings turned on in your php.ini or server
configuration.
 [2008-04-01 18:10 UTC] webmaster at onmyway dot cz
Had this error too, spend hours figuring it out, finally wrote an entire page about it to post here and during testing I found this was a misconfiguration in .htaccess

Hope this helps anyone experiencing the same error. Enjoy
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC