Skip to content

Add missing cache engine method proxies - #1084

Merged
dereuromark merged 2 commits into
cakephp:5.xfrom
micheleprimavera-fattura:5.x
Aug 13, 2026
Merged

Add missing cache engine method proxies#1084
dereuromark merged 2 commits into
cakephp:5.xfrom
micheleprimavera-fattura:5.x

Conversation

@micheleprimavera-fattura

@micheleprimavera-fattura micheleprimavera-fattura commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

When the Cache panel is enabled, the engine is wrapped into a DebugEngine, which has an empty configuration. Calling add() or has() on this engine generates a warning on a missing prefix key and overall does nothing.

2026-08-13 14:22:44 warning: Undefined array key "prefix" in /Users/michele/fatturaelettronicapa/vendor/cakephp/cakephp/src/Cache/CacheEngine.php on line 373
Trace:
Cake\Error\ErrorTrap->handleError() /Users/michele/fatturaelettronicapa/vendor/cakephp/cakephp/src/Cache/CacheEngine.php, line 373
Cake\Cache\CacheEngine->_key() /Users/michele/fatturaelettronicapa/vendor/cakephp/cakephp/src/Cache/CacheEngine.php, line 304
Cake\Cache\CacheEngine->add() /Users/michele/fatturaelettronicapa/vendor/cakephp/cakephp/src/Cache/Cache.php, line 605
Cake\Cache\Cache::add() /Users/michele/fatturaelettronicapa/vendor/cakephp/queue/src/QueueManager.php, line 296
[...]

This fixes #1083

@jamisonbryant

Copy link
Copy Markdown
Contributor

Looks okay to me, though the DebugEngine appears to wrap the configured cache engines rather than replacing them. Doing this eliminates the call to _key() that CacheEngine would make, which is what sidesteps the missing array key warning. I think it would be nice to perhaps make the CacheEngine itself more robust to missing config, but we can take care of that in Cake core.

The stan failures do not appear to be related to this change. @ADmad @dereuromark do either of you have any pointers on what needs to change in this branch to get the baseline back to green? Looks like it has been failing since the dependabot updates on/around August 2nd.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes DebugKit’s cache-engine wrapper so that add()/has() calls are properly proxied to the wrapped CakePHP cache engine when the Cache panel is enabled, preventing warnings from the wrapper’s empty internal configuration and restoring correct behavior/telemetry.

Changes:

  • Add DebugEngine::add() proxy to delegate to the wrapped engine while tracking “set” metrics and logging the operation.
  • Add DebugEngine::has() proxy to delegate to the wrapped engine while tracking hit/miss metrics and logging the operation.
  • Extend/adjust DebugEngine tests to cover the new proxy methods and updated metrics/log expectations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Cache/Engine/DebugEngine.php Adds missing add()/has() proxies so DebugEngine no longer falls back to base implementations that rely on its empty _config.
tests/TestCase/Cache/Engine/DebugEngineTest.php Updates tests to exercise add()/has() and validates updated metrics/log output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@micheleprimavera-fattura

Copy link
Copy Markdown
Contributor Author

Looks okay to me, though the DebugEngine appears to wrap the configured cache engines rather than replacing them

yes that's what I meant, sorry for the poor choice of words!

@jamisonbryant

Copy link
Copy Markdown
Contributor

@micheleprimavera-fattura no worries, didn't mean to nitpick, was just confirming my own understanding.

#1085 should correct the stan errors on the base branch, can you rebase yours off of it? That should make the pipeline go green on this branch.

@dereuromark
dereuromark merged commit 551b709 into cakephp:5.x Aug 13, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

debug_kit Cache panel DebugEngine does not override add(), resulting in broken add operations to caches

4 participants