php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10993 filesize on newly made/just opened file weirdness
Submitted: 2001-05-21 13:34 UTC Modified: 2001-05-21 15:47 UTC
From: wico at cnh dot nl Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.5 OS: linux
Private report: No CVE-ID: None
 [2001-05-21 13:34 UTC] wico at cnh dot nl
Hiya

run this test script and and watch the output differ depending on using filesize or not

	$fp = fopen('file.test', "a+b");
	
	//(un)comment this line
	filesize('file.test');
	
	fwrite($fp, "boe");
	fclose($fp);

	$fp2 = fopen('file.test', "a+b");
	fseek($fp2, 0);
	echo fread($fp2, filesize('file.test'));

	unlink('file.test');

Greetz,

Wico

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-21 15:47 UTC] swm@php.net
The results of filesize() are cached. You will need to
reload the cache for this file in order that it return the
correct result.

See clearstatcache() and filesize() documentation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 08:01:32 2024 UTC