[php-src] Issue #18772: opcache doesn't list all files with the same path when using chroot (opcache_get_status())
| From: | dugwood | Date: | Thu, 05 Jun 2025 09:42:08 +0000 |
| Subject: | [php-src] Issue #18772: opcache doesn't list all files with the same path when using chroot (opcache_get_status()) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250209@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/18772
Author: dugwood
### Description
The following code:
```php
<?php
echo '<pre>';
print_r(opcache_get_status());
```
Resulted in this output:
```
Array
(
[...]
[scripts] => Array
(
[/htdocs/temp.php] => Array
(
[full_path] => /htdocs/temp.php
[...]
)
```
But I expected this output instead:
```
Array
(
[...]
[scripts] => Array
(
[(chroot:/home/user1)/htdocs/temp.php] => Array
(
[full_path] => /htdocs/temp.php
[...]
)
[(chroot:/home/user2)/htdocs/temp.php] => Array
(
[full_path] => /htdocs/temp.php
[...]
)
```
When using
opcache.validate_root=1, same paths across different chroot are listed as
one file only. There should be multiple keys.
Prefix is hashed using the inode number, which is working fine (so it's not a collision bug!):
https://github.com/php/php-src/blob/7f914620193079b42a91eb84451719e4b376702b/ext/opcache/ZendAccelerator.c#L2673
Also the https://github.com/amnuts/opcache-gui/
doesn't work on invalidating those specific files. Don't know if it's related, but
it's possible.
### PHP Version
```plain
PHP 8.2.28 (cli) (built: Mar 13 2025 18:21:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
```
### Operating System
Debian 12