Problem
The advisor cache is the last serialize()-based store in the framework (src/Core/CachedAspectLoader.php:113-141: serialize() at ~:118, @unserialize() at ~:136), while CachePathManager::writeCacheFile() already emits <?php return …; files that opcache keeps compiled. Costs today:
- Every request re-parses a serialized blob that opcache cannot cache.
@unserialize() silently swallows corruption.
- Object-graph revival forces the
__sleep/__wakeup/__serialize machinery, which reaches back into the AspectKernel singleton (src/Aop/Framework/AbstractInterceptor.php:145, src/Aop/Pointcut/PointcutReference.php:54-62).
Proposed design (for discussion)
- Emit advisor definitions as a compiled PHP file: either
var_exported construction code or a compact array descriptor + factory that rebuilds pointcuts/advisors.
- Include a cache-format version marker so stale cache dirs re-warm automatically.
- Fold in migrating
PointcutReference from __sleep/__wakeup to __serialize/__unserialize (the only legacy pair left in src/), which also unblocks making it readonly.
Effort L, risk medium (cache format change). Needs design discussion before implementation — notably how closures/first-class-callable advices are represented in exported form, and interplay with #618.
Problem
The advisor cache is the last
serialize()-based store in the framework (src/Core/CachedAspectLoader.php:113-141:serialize()at ~:118,@unserialize()at ~:136), whileCachePathManager::writeCacheFile()already emits<?php return …;files that opcache keeps compiled. Costs today:@unserialize()silently swallows corruption.__sleep/__wakeup/__serializemachinery, which reaches back into theAspectKernelsingleton (src/Aop/Framework/AbstractInterceptor.php:145,src/Aop/Pointcut/PointcutReference.php:54-62).Proposed design (for discussion)
var_exported construction code or a compact array descriptor + factory that rebuilds pointcuts/advisors.PointcutReferencefrom__sleep/__wakeupto__serialize/__unserialize(the only legacy pair left insrc/), which also unblocks making itreadonly.Effort L, risk medium (cache format change). Needs design discussion before implementation — notably how closures/first-class-callable advices are represented in exported form, and interplay with #618.