note 72421 rejected from migration5.incompatible by nlopess

From: Date: Thu, 18 Jan 2007 14:23:54 +0000
Subject: note 72421 rejected from migration5.incompatible by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121888@lists.php.net to get a copy of this message
Note Submitter: baptiste dot pillot at atgp dot net ---- fopen uses stat cache in PHP5. It could cause problems if you open files in append mode, as the file pointer will point on last known end of file, and does not check if the file is bigger. Example : // first call creates the file an set position to zero $f = fopen("filename.txt", "a"); fputs($f, "Hello World\n"); fclose($f); // PHP4 : second call opens the file and points on end // PHP5 : second call opens the file and points on zero ! // you should do a clearstatcache(); here $f = fopen("filename.txt", "a"); fputs($f, "Second Hello World over\n"); fclose($f); // result in PHP5 : the file only contains "Hello World over"

« previous php.notes (#121888) next »