Skip to content

opcache.revalidate_path and opcache.use_cwd noop? #4583

Open
@kkmuffme

Description

@kkmuffme

Description

The following code:

It's unclear what exactly the difference between opcache.revalidate_path and opcache.use_cwd is and it seems they're noop (in CLI?)?
Assuming php.ini has: include_path=/dev/null

/foo/safe.php
/bar/safe.php

<?php
function run() {
    echo __FILE__;
}

/foo/x.php
/bar/y.php

<?php
include 'safe.php';

/test.php

<?php
require __DIR__ . '/foo/x.php';
require __DIR__ . '/bar/y.php';

run();

php -dopcache.enable_cli=1 -dopcache.revalidate_path=0 -dopcache.use_cwd=0 test.php

Resulted in this output:

Cannot redeclare run()

But I expected this output instead:

/foo/safe.php

Changing /foo/x.php or /bar/y.php to

<?php
opcache_compile_file('safe.php');

has the same issue too.

According to php/php-src#17769 (comment) this shouldn't result in a fatal, because the provided path is the same for both, so it shouldn't even attempt to load the other

Also it's not entirely clear what the difference between these 2 directives actually is, based on a practical example.

PHP Version

PHP 8.4

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions