|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16225 fwrite/fputs writes everthing twice with 'a' mode
Submitted: 2002-03-22 16:49 UTC Modified: 2002-03-22 17:10 UTC
From: speltzer at unisolutions dot de Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.1.2 OS: SuSe Linux 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: speltzer at unisolutions dot de
New email:
PHP Version: OS:


 [2002-03-22 16:49 UTC] speltzer at unisolutions dot de
if fopen opened a file with a or a++ fwrite writes everthing twice into the output file.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-22 17:10 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

 [2003-01-28 03:02 UTC] hematec at gmx dot de
I had the same problem under win xp and apache 2.0.44 with php4:

fwrite writes sometimes strings twice in the file:

my sourcecode is:

if (($artikel_nr!='') and ($artikel_anzahl>0))
//?berpr?fen ob heutiger wk existiert, sonst anlegen!!
//Datei ?ffnen
	$file_handler=fopen($datei, 'r');
	do {
	$tmp_string=$tmp_string.fgets($file_handler, 500)."\n";
	} while (!feof($file_handler));

//artikel-string erzeugen und in datei schreiben
//in Datei schreiben	
//datei schlie?en

<script language=JavaScript>

	function neu_sortieren(kriterium){

	function artikel_in_korb(){
		var fehler=0;
		//artikeldaten holen
		var artikel_nr='';
		var kundennummer='';
		var session_nr='';
		//bestellmenge ?berpr?fen
		var tmp=document.bestellen.artikel_anzahl.value;
		if (isNaN(tmp)){
			fehler=2;alert('fehler 2');}

		//artikeldaten ?berpr?fen
		if (document.bestellen.artikel_nr.value==''){fehler=1;}
		if (fehler==0){
		if (fehler==1){
			alert('Sie haben kein Artikel markiert!');
		if (fehler==2){
			alert('Die Bestellmenge ist nicht ganzzahlig!');

<title>markierte Artikel in Warenkorb legen</title>

<body bgcolor="#6666FF">

<form name='bestellen' method='post'>
<div align="center">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="760" id="AutoNumber1">
      <td width="55">&nbsp;</td>
      <td width="75">
      <p align="right"><font face="Arial" size="1" color="#FFFFFF">Anzahl</font></td>
      <td width="50">
      <input type="text" size="4" name="artikel_anzahl" value="1">&nbsp; </td>
      <td width="60">
      <font size="1" face="Arial" color="#FFFFFF">Bemerkung</font></td>
      <td width="200">
      <input type="text" name="bemerkung" size="30"></td>
      <td width="195">
      &nbsp;<input type="submit" value="Artikel in Korb" onclick='javascript:artikel_in_korb();'></td>
      <td width="125">&nbsp;</td>

<input type=hidden name=artikel_nr>
<input type=hidden name=kundennummer>
<input type=hidden name=session_nr>
</form><!-- bestellen -->
  <div align="center">
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-right-width:0; border-top-width:0; border-bottom-width:0" bordercolor="#000000" width="772" id="AutoNumber2" bgcolor="#9999FF">
      <td width="70" align="center" style="border-top-color: #000000; border-top-width: 1; border-bottom-color: #000000; border-bottom-width: 1">
      <b><a href="JavaScript:neu_sortieren('artikelnr');"><font size="2" face="Arial" color="#ffffff">Artikelnr.</font></a></b></td>
      <td width="90" align="center" style="border-top-color: #000000; border-top-width: 1; border-bottom-color: #000000; border-bottom-width: 1">
      <b><a href="JavaScript:neu_sortieren('herstnr');"><font size="2" face="Arial" color="#ffffff">Herstellernr.</font></b></a></td>
      <td width="410" align="center" style="border-top-color: #000000; border-top-width: 1; border-bottom-color: #000000; border-bottom-width: 1">
      <b><a href="JavaScript:neu_sortieren('bezeichnung');"><font size="2" face="Arial" color="#ffffff">Bezeichnung</font></b></a></td>
      <td width="70" align="center" style="border-top-color: #000000; border-top-width: 1; border-bottom-color: #000000; border-bottom-width: 1">
      <b><a href="JavaScript:neu_sortieren('preis');"><font size="2" face="Arial" color="#ffffff">Preis</font></b></a></td>
      <td width="110" align="center" style="border-top-color: #000000; border-top-width: 1; border-bottom-color: #000000; border-bottom-width: 1">&nbsp;</td>
      <td width="16" align="center" bgcolor="#6666FF" style="border-left-style: solid; border-left-width: 1; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom-style: none; border-bottom-width: medium">&nbsp;</td>


PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Jun 24 04:01:26 2021 UTC