Skip to content

Invalidate path even if the file was deleted #12323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

mikhainin
Copy link
Contributor

If the script was cached and deleted, the current implementation will not be able to invalidate it.
This change makes it still possible to delete script and then force its invalidation

Copy link
Member

@dstogov dstogov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch makes sense. The minimal changes are requested.

I think, it may make sense to target this to PHP-8.3.
@adoy @bukka @ericmann @iluuu1994 what do you think?

@bukka
Copy link
Member

bukka commented Oct 2, 2023

This could be in some way considered as a bug fix so I'm fine this going to PHP 8.3.

@dstogov Do you see any issue with this going even to 8.2? Seems like logical behaviour to be able to invalidate deleted file.

@mikhainin mikhainin force-pushed the opcache-invalidate-deleted-file branch from 68a452e to a5ab365 Compare October 2, 2023 11:24
@mikhainin mikhainin force-pushed the opcache-invalidate-deleted-file branch from a5ab365 to 3b7c0da Compare October 2, 2023 13:23
@mikhainin
Copy link
Contributor Author

Ooh, we seem to have a test checking this return value. Updated the test as well

@iluuu1994
Copy link
Member

@dstogov Not that I object, but always returning true is the bigger BC break here, given that this function has previously returned false for both deleted and otherwise unlocatable files. As PHP is implementation defined, IMO we should adjust the documentation rather than the behavior. I could find at least a handful of usages where the result of opcache_invalidate is used.

https://sourcegraph.com/search?q=context:global+%22%3D+opcache_invalidate%28%22&patternType=standard&sm=1&groupBy=repo

@TimWolla
Copy link
Member

TimWolla commented Oct 2, 2023

I agree with Ilija here. Successfully resetting the cache for a file and telling the developer it failed is not great, but safe. Not successfully resetting the cache (because the realpath is different) and telling the developer it succeeded might be unsafe if the developer relies on the reset working.

@dstogov
Copy link
Member

dstogov commented Oct 2, 2023

OK. I have to agree.

@mikhainin please revert it back and sorry for the noise.

@mikhainin mikhainin force-pushed the opcache-invalidate-deleted-file branch from 3b7c0da to c54983a Compare October 3, 2023 06:58
@mikhainin
Copy link
Contributor Author

mikhainin commented Oct 3, 2023

Not a problem, returned the initial change - the test is now not broken and not changed

@dstogov
Copy link
Member

dstogov commented Oct 3, 2023

@iluuu1994 please merge this into appropriate branch (I'm not sure 8.3 or 8.1).

@iluuu1994 iluuu1994 force-pushed the opcache-invalidate-deleted-file branch from c54983a to 736a420 Compare October 3, 2023 11:43
@iluuu1994 iluuu1994 changed the base branch from master to PHP-8.1 October 3, 2023 11:44
@iluuu1994 iluuu1994 closed this in f4ab494 Oct 3, 2023
@iluuu1994
Copy link
Member

Great, thank you @mikhainin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants