CodeIgniter Forums
Output Class bug - Last-modified header - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: Output Class bug - Last-modified header (/showthread.php?tid=61534)



Output Class bug - Last-modified header - khoggatt - 04-22-2015

There appears to be a bug in core/Output.php in CI 3.0.

On like 677 of Output.php, there is this line:
$last_modified = filemtime($cache_path);

The $last_modified value is used to set the Last-modified header for conditional caching on the client (used on subsequent HTTP requests to determine whether a 304 Not Modified response is allowed).

However, if you look at the code, you see that $cache_path is pointing to the cache DIRECTORY, not the specific cache FILE that we are trying to get the timestamp for. The result is inaccurate modification times, that basically prevent 304 responses on any busy site.

The correct line should use $filepath, which points to the actual cache file:
$last_modified = filemtime($filepath);

-Kyle


RE: Output Class bug - Last-modified header - CroNiX - 04-22-2015

Did you report the issue on github?


RE: Output Class bug - Last-modified header - ivantcholakov - 04-23-2015

We might forget about this bug, I will make a report in GitHub.

Edit: https://github.com/bcit-ci/CodeIgniter/pull/3801


RE: Output Class bug - Last-modified header - alkarim - 04-24-2015

Report about the bug on github and than x for the bug notification.