|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65913 opcodes generated by dynamic inheritance not cached
Submitted: 2013-10-16 12:48 UTC Modified: 2016-11-18 21:07 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: seng dot gavin at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: Irrelevant OS: All
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-10-16 12:48 UTC] seng dot gavin at gmail dot com
According to Gopal in this insightful blog post 6 years ago:

I will borrow the terms used in the above post:
- static - opcodes have been replaced with NOOPs
- dymamic - no opcodes have been replaced

When dynamic inheritance is detected, the following should happen:
- Any cached opcodes for that file become invalid
- We will always recompile the file thereafter

The current behaviour seems to be:
- Any cached opcodes will still be valid (and used as long as on that page request, dynamic inheritance is not detected i.e. the parent class is already known by zend and thus the NOOP makes sense)
- Only if dynamic inheritance is detected, will a recompile happen.

Other than the discrepancy in behaviour between the blog and code, it seems strange that we opt to cache the static version which is not always usable and recompile the dynamic version which is always usable. Furthermore, I'm not sure why we should not cache the dynamic version and use it thereafter.

This patch changes the behaviour to:
- Static opcodes will be cached and used until dynamic inheritance is detected
- When dynamic inheritance is detected, the dynamic opcodes are cached instead
- Thereafter, every request for the file (regardless of whether we can use a static or dynamic version) will always get the cached dynamic version.


apc_cache_dynamic_inheritance (last revision 2013-10-16 12:48 UTC by seng dot gavin at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-18 21:07 UTC]
-Status: Open +Status: Wont fix
 [2016-11-18 21:07 UTC]
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 04:01:30 2024 UTC