From: dean at omnivisiontechnology dot com Operating system: PHP version: 5.5.0RC1 Package: Filesystem function related Bug Type: Feature/Change Request Bug description:getlastmod() should (optionally) check modification times of include files also
Description: ------------ Currently the getlastmod() function is essentially an alias for filemtime($_SERVER["SCRIPT_FILENAME"]). Considering that a primary use case for this function is to supply the time for a HTTP Last-Modified header, and that the output of the page may change if any of its include or require files change, it would be nice to have the option for getlastmod() to return the latest modification time of (any of) the main script AND its includes (recursively, checking includes of includes and so on). (At least the ones included up to the time the function was called, if they can't be checked in advance during some parsing phase?) To preserve backward compatibility, this feature might be activated by passing the parameter "true", i.e. getlastmod(true) to check include files also. A php-coded version of what I mean is included below just for clarification, although it can't (I think) check multiply-nested include files. Test script: --------------- function new_getlastmod($checkAll = false) { if (!$checkAll) return getlastmod(); $t = 0; foreach(get_included_files() as $f) if ((($mt = filemtime($f))!==false)&&($mt>$t)) $t = $mt; return ($t ? $t : false); } -- Edit bug report at https://bugs.php.net/bug.php?id=64885&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64885&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64885&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64885&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64885&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64885&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64885&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64885&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64885&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64885&r=support Expected behavior: https://bugs.php.net/fix.php?id=64885&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64885&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64885&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64885&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64885&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64885&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64885&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64885&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64885&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64885&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64885&r=mysqlcfg