Skip to content

opcache doesn't list all files with the same path when using chroot (opcache_get_status()) #18772

Open
@dugwood

Description

@dugwood

Description

The following code:

<?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!):

ZCG(root_hash) = buf.st_ino;

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions