I believe this to be a bug in php, but I'm opening an issue here to discuss it.
I have the following settings in my php.ini for opcache:
Confirm that Opcache is running, then run:
Now comment out the call to opcache_reset in lib/classes/string_manager_standard.php and re-run.
I'm struggling to replicate this exactly as it outside of Moodle, however it appears that something is amiss with upstream php's opcache.
Calling opcache_reset() causes subsequent calls to opcache_invalidate() to fail. The documentation for invalidate suggests that it will only return false if opcache is disabled, otherwise it returns true. The attached testcase.php suggests otherwise. This calls opcache_invalidate() on a real file both before and after a call to opcache_reset(). After the first call to opcache_reset(), all subsequent calls to opcache_reset() and opcache_validate() return false.
This could be a bug in php, or it could be a php documentation issue. Either way, we may need to work around it in Moodle.