Doc #64881 [Opn]: It's unclear how getlastmod is affected by includes/requires

From: Date: Tue, 21 May 2013 01:17:33 +0000
Subject: Doc #64881 [Opn]: It's unclear how getlastmod is affected by includes/requires
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-9862@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=64881&edit=1 ID: 64881 User updated by: dean at omnivisiontechnology dot com Reported by: dean at omnivisiontechnology dot com Summary: It's unclear how getlastmod is affected by includes/requires Status: Open Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Ok, then what I'd suggest is that "time of the last modification of the current page" be changed to "time of the last modification of the current script file" in both the "Description" and "Return values" section of the doc page. Additionally it should note that this is always the modification time of the top-level script file, even if called from within an include file; modification times of include files don't count. I'll log a separate feature request asking that functionality be added to getlastmod() to check included file modification dates also. Previous Comments: ------------------------------------------------------------------------ [2013-05-20 20:11:50] mail+php at requinix dot net 1. When the documentation says "page" it really means "file" (ie, __FILE__). So >Gets the time of the last modification of the current file. 2. PHP can't know what files may be include()d later on, but you can use get_included_files() and filemtime() a la the comment by Moro [1] to get the most recent modification date of the ones include()d so far. IMO a feature request to bundle this into getlastmod() seems quite reasonable but you might want to make a separate feature request ticket so this one can remain a bug report. [1] http://php.net/function.getlastmod#109250 ------------------------------------------------------------------------ [2013-05-20 11:28:07] dean at omnivisiontechnology dot com Description: ------------ It isn't clear from the manual page whether getlastmod() only checks the modification date of the main script file, or whether it takes into account modification dates of all include/require files also. Actually there are two issues: (1) If I use getlastmod() inside an include file, does it report the modification date of the include file, or of the main including script? (2) If I use getlastmod() inside a script that uses INCLUDE or REQUIRE to inline other files, and at least one of these has been modified more recently than the main including script, will this more recent modification date be returned by getlastmod()? If the answer to (2) is NO, then perhaps there should be an extension to getlastmod() (a boolean argument perhaps) or else a separate function that DOES work this way? A lot of webpages for example, are constructed by INCLUDE-ing a header and footer around the main content of the page; the reported modification date of the page should reflect a modification to any of these. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64881&edit=1

« previous php.doc.bugs (#9862) next »