[php-src] PR #25566: Add `opcache_shm_read_locked` and `opcache_last_restart_time`
| From: | ericnorris | Date: | Wed, 18 Nov 2026 18:50:02 +0000 |
| Subject: | [php-src] PR #25566: Add `opcache_shm_read_locked` and `opcache_last_restart_time` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40788@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25566
Author: ericnorris
Hello! I've been working on an extension that interacts with opcache and I realized that (a)
there was no public API to tell me if it was safe to read from opcache's shared memory, and (b)
it would be much cleaner if I didn't need to call
opcache_get_status to know
whether that memory had been reset by a restart since an earlier request. Calling
opcache_get_status from an extension is problematic because
opcache.restrict_api may trigger a warning if the script is restricted from using
opcache.
This adds opcache_shm_read_locked for (a) and opcache_last_restart_time
for (b). I see that zend_accel_restart_hook was added very recently, but I believe that
the restart hook only fires for the process that carried out the restart (e.g. in Apache w/
prefork), so other workers can't use it for (b).
Full disclosure, this was written by Claude.