ID: 36189 Updated by: [EMAIL PROTECTED] Reported By: aemulus at hotmail dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Fedora Core 3 PHP Version: 5.1.2 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is because PHP employs a cache for this, use clear_stat_cache() and it will work fine. Previous Comments: ------------------------------------------------------------------------ [2006-01-28 10:57:47] aemulus at hotmail dot com Description: ------------ When reading in a file modified timestamp, then writing to the file, if you read the modified timestamp right after closing the file, it shows the same modification stamp. Reproduce code: --------------- $downloadfile = 'http://www.somewebservice.com/stat.xml'; $filename = 'somefile.txt'; $data = geturlfile($downloadfile,2); if (file_exists($filename)) { echo "filemtime1: ".date("F d Y H:i:s.",filemtime($filename)); } $cont=fopen($filename,'w'); $didwrite = fwrite($cont,$data); fclose($cont); print "<br>Written: ".$didwrite."<br>"; if (file_exists($filename)) { echo "filemtime2: " . date ("F d Y H:i:s.", filemtime($filename)); } //functions function geturlfile($link2,$timeout) { $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,$link2); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,$timeout); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)) { return "0"; } else { return $buffer; } } Expected result: ---------------- Both timestamps will be identical for "filemtime1" and "filemtime2" Actual result: -------------- filemtime1: January 28 2006 04:44:49. Written: 9996 filemtime2: January 28 2006 04:44:49. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36189&edit=1