Bug #15118 Updated: fopen and fwrite writes to much data in mode a and a+

From: Date: Sun, 20 Jan 2002 01:01:42 +0000
Subject: Bug #15118 Updated: fopen and fwrite writes to much data in mode a and a+
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77548@lists.php.net to get a copy of this message
ID: 15118
Updated by: derick
Reported By: bitbybit@fibre.a2000.nl
Status: Duplicate
Bug Type: Filesystem function related
Operating System: W2K
PHP Version: 4.1.1
New Comment:

Two exactly the same postings = Bogus


Previous Comments:
------------------------------------------------------------------------

[2002-01-19 17:23:49] lobbin@php.net

Dupe of #15117

Please, post only once.

------------------------------------------------------------------------

[2002-01-19 17:12:55] bitbybit@fibre.a2000.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);
fclose($fp);

---- 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	

Bug:
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
expected.
I haven't tested fopen() in all other available modes.


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=15118&edit=1



Thread (4 messages)

« previous php.dev (#77548) next »