|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-04 15:16 UTC] rasmus@php.net
[2012-03-04 15:16 UTC] rasmus@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 19:00:01 2025 UTC |
Description: ------------ Once a SplFileObject instance was created​​, filemtime() does not return the latest modification time of the file. Test script: --------------- filemtime.php <?php $file = '/tmp/test'; touch($file); $fileObject = new SplFileObject($file); // If comment out this line, it works well. touch($file, time() + 1); echo 'time(): ' . date('Y-m-d H:i:s', time()) . PHP_EOL; echo 'time() + 1: ' . date('Y-m-d H:i:s', time() + 1) . PHP_EOL; echo 'filemtime($file): ' . date('Y-m-d H:i:s', filemtime($file)) . PHP_EOL; echo 'filemtime($file)@subprocess: '; passthru('php -r "echo date(\'Y-m-d H:i:s\', filemtime(\'/tmp/test\')) . PHP_EOL;"'); Expected result: ---------------- $ php filemtime.php time(): 2012-03-04 18:37:01 time() + 1: 2012-03-04 18:37:02 filemtime($file): 2012-03-04 18:37:02 filemtime($file)@subprocess: 2012-03-04 18:37:02 Actual result: -------------- $ php filemtime.php time(): 2012-03-04 18:37:01 time() + 1: 2012-03-04 18:37:02 filemtime($file): 2012-03-04 18:37:01 filemtime($file)@subprocess: 2012-03-04 18:37:02