|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15118 fopen and fwrite writes to much data in mode a and a+
Submitted: 2002-01-19 17:12 UTC Modified: 2002-01-19 20:02 UTC
From: bitbybit at fibre dot a2000 dot nl Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.1.1 OS: W2K
Private report: No CVE-ID: None
 [2002-01-19 17:12 UTC] bitbybit at fibre dot a2000 dot nl
---- code ----
$orderstring = $date."\t".	//current time
	$tireqty." tires\t".	//received form field
	$oilqty." oil\t".	//received form field
	$sparkqty." sparks\t".	//received form field
	$totalamount."\t".	/calc. from form fields
	$address."\n";		//received form field

$fp = fopen("orders.txt", "a");
fwrite($fp, $orderstring);

---- output in orders.txt ----
22:32 19th Saturday 2002	4 tires	1 oil	12 sparks	503.80	NL
22:32 19th Saturday 2002	 tires	 oil	 sparks	0.00	

When using fopen() in mode a or a+ the last line will be added without
any obvious cause.
When fopen() is used in same code but in mode w it works correct like
I haven't tested fopen() in all other available modes.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-19 17:23 UTC]
Dupe of #15117

Please, post only once.
 [2002-01-19 20:01 UTC]
Two exactly the same postings = Bogus
 [2002-01-19 20:02 UTC]
Two exactly the same postings = Bogus
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 13:03:38 2021 UTC