|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66639 Use ctime for file verification
Submitted: 2014-02-04 01:40 UTC Modified: 2014-02-04 01:48 UTC
Avg. Score:4.4 ± 0.8
Reproduced:11 of 11 (100.0%)
Same Version:11 (100.0%)
Same OS:10 (90.9%)
From: nmerdan at reflected dot net Assigned:
Status: Open Package: opcache
PHP Version: 5.5.8 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-02-04 01:40 UTC] nmerdan at reflected dot net
In order to avoid problems when preserving timestamps using rsync and similar tools it might be desirable to check ctime instead of mtime when checking if script needs to be invalidated. APC has this option and it comes quite useful.

Attached is a patch that enables this, it is lacking documentation and tests (?), but I can create them too if this gets accepted.

Test script:
echo "foo";

Expected result:
If you set opcache.stat_ctime and run the script for the first time, it should not be cached. If you then run it again you should see it cached like this:

                    [full_path] => /tmp/test.php
                    [hits] => 0
                    [memory_consumption] => 1240
                    [last_used] => Mon Feb  3 20:37:05 2014
                    [last_used_timestamp] => 1391477825
                    [timestamp] => 1391477689

Then just 'chmod' the script so it changes ctime, but not mtime, then run it again and you will get the empty array. Next time you run it, it will be cached.


opcache_ctime (last revision 2014-02-04 01:41 UTC by nimzo at nimzo dot info)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-04 01:48 UTC] nmerdan at reflected dot net
-: nimzo at nimzo dot info +: nmerdan at reflected dot net
 [2014-02-04 01:48 UTC] nmerdan at reflected dot net
The current behavior is to only check mtime only of course, if that wasn't clear.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Mar 02 15:01:28 2024 UTC