# [PATCH] opcache bug #69090, prepend user identifier to keys

- Thread: https://externals.io/message/96828
- Original archive: https://news-web.php.net/php.internals/96828
- Started by Dmitry Stogov on 2016-11-11T07:40:56+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #96828 — Dmitry Stogov — 2016-11-11T07:40:56+00:00

URL: https://externals.io/message/96828#96828

>
> Hello Dmitry,
>
> A quick question after considering your comments and doing a bit more
> homework on extension lifetime:
>
> 
> > […]
>
> Looks like OPCache currently does not implement a request_startup_func for
> per-request initialization. I'm assuming this was avoided for
> performance reasons and due to no perceived need until now for
> per-request initialization. This seems like it would be the proper point
> in extension lifetime to call geteuid() and save results in the
> zend_accel_globals struct to use during key construction. Correct? Any
> objection to my implementing this?

See zend_accel_activate() in ZendAccelerator.c

>
> I'm also thinking the `stat()` for device+inode should be done in opcache
> code at file compilation time; correct?

It's not a problem to make extra `stat()` at script compile (I think we already do it to record mtime), however we will have to do it also on each access.

>
> Would this be a step in the right direction? Apologies if these are
> basic questions; I'm new to PHP extensions but strongly motivated to fix
> OPCache keys quickly. I may have time for a second pass at this over the
> weekend.

I see your point, but I don't like a quick fix, I like a "good" fix.
And I hope, our discussion could lead us to some better solution :)

Thanks. Dmitry.

>
> -php-dev at coydogsoftware dot net
