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

From: Date: Fri, 08 Nov 2013 08:16:12 +0000
Subject: Doc #64881 [Opn->Csd]: 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-10591@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 Updated by: krakjoe@php.net Reported by: dean at omnivisiontechnology dot com Summary: It's unclear how getlastmod is affected by includes/requires -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: krakjoe Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. getlastmod either executes a SAPI handler or references a global stat cache for PATH_TRANSLATED, it does not have anything to do with __FILE__. Documentation updated for clarity. Previous Comments: ------------------------------------------------------------------------ [2013-11-08 08:15:21] krakjoe@php.net Automatic comment from SVN on behalf of krakjoe Revision: http://svn.php.net/viewvc/?view=revision&revision=332085 Log: #64881 update wording for clarity ------------------------------------------------------------------------ [2013-05-21 01:17:33] dean at omnivisiontechnology dot com 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. ------------------------------------------------------------------------ [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 (#10591) next »