|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74268 Opcache fails to detect directory symlink changes
Submitted: 2017-03-17 21:07 UTC Modified: -
Avg. Score:4.3 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:2 (28.6%)
Same OS:3 (42.9%)
From: marshall at ahoy dot com Assigned:
Status: Open Package: opcache
PHP Version: 7.1.3 OS: Linux Ubuntu 16.04.2 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: marshall at ahoy dot com
New email:
PHP Version: OS:


 [2017-03-17 21:07 UTC] marshall at ahoy dot com
When a directory symlink is changed to a new target directory and the new target contains file names that were also in the old target directory, OPcache sometimes returns the old file instead of the new file.

lrwxrwxrwx 1 root root     2 Mar 17 20:28 v -> v1
-rw-r--r-- 1 root root    60 Mar 17 20:22 test.php
drwxr-xr-x 2 root root  4096 Mar 17 20:22 v2
drwxr-xr-x 2 root root  4096 Mar 17 20:21 v1

Both v1 and v2 contain home.php with different contents

Changing the symlink v from v1 to v2 does not always cause the desired result.  Sometimes OPcache alternates between the two different home.php pages.

Using FPM/FastCGI with PHP Version
Same problem using PHP Version 7.0.15

Test script:
echo "This is test.php\n";

echo "This is v1/home.php\n";

echo "This is v2/home.php\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2022-01-11 23:23 UTC] jake at qzdesign dot co dot uk
`touch`ing or updating the file in either the old or the new symlink does not resolve the issue - it can even be seen that code newly added into the old symlink gets executed.

Adding `opcache_reset()` into the code in the old symlink does however resolve the issue for the next page load - thus showing that the issue is with OPcache.

(PHP 7.3.33 LiteSpeed V7.9 Cloudlinux 1.3)
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 22 20:01:29 2024 UTC