From: aemulus at hotmail dot com Operating system: Fedora Core 3 PHP version: 5.1.2 PHP Bug Type: Date/time related Bug description: filemtime()
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 bug report at http://bugs.php.net/?id=36189&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36189&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36189&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36189&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36189&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36189&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36189&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36189&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36189&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36189&r=support Expected behavior: http://bugs.php.net/fix.php?id=36189&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36189&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36189&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36189&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36189&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36189&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36189&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36189&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36189&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36189&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36189&r=mysqlcfg