Generated with the help of an LLM.
AI helped us debug our initial test failure. I pointed AI to the cause of the regression myself but used AI to verify that backporting the referenced issue would fix it and to run both our own and a Drupal core test on it.
I have thoroughly read and validated the report below and ensured all links to issues are correct and working.
Problem/Motivation
We found this because our tests broke after updating from 10.6.20 to 10.6.22. Several Behat scenarios that save content started failing on logged warnings: "Theme hook field not found." and "Theme hook time not found.".
10.6.22 (SA-CORE-2026-018) added $this->reset() to CacheCollector::destruct(), as #3486503: Add a file parsing cache collector to replace some uses of FileCache did for 11.x. ThemeRegistry is a CacheCollector, so after Registry::destruct() runs, the runtime theme registry it holds is emptied. Registry::getRuntime() keeps returning that same emptied object. ThemeRegistry::has() reads $this->storage directly and doesn't load it again, so every theme hook is reported as missing.
Anything that renders after theme.registry was destructed in the same request hits this. For example, Search API's post-request indexing (search_api.post_request_indexing, a needs_destruction service) renders the "Rendered HTML output" field after the theme registry was destructed. That logs "Theme hook ... not found." for each hook and indexes the item without that output.
#3626105: Release runtime theme registries after destruction fixed this in main and 11.x (and is in 11.5.x and 12.0.x): Registry::destruct() releases its runtime registries, so the next getRuntime() builds a fresh one.
It wasn't backported, as the CacheCollector on prior versions was not yet updated. so these releases have the reset() without the fix:
- 10.6.22 (from the security release)
- 11.3.22 (from the security release)
- 11.4.0 to 11.4.13 (from #3486503)
Yesterday's security release has backported the reset() call and must thus also backport the ThemeRegistry fix
Steps to reproduce
Minimal, in core:
Apply only the test from #3626105: Release runtime theme registries after destruction (RegistryTest::testRuntimeRegistryAfterDestruct()) to 10.6.x. It fails at $this->assertTrue($next_runtime_registry->has($hook));, because after destruct() the runtime registry no longer has any hooks. With the fix from #3626105: Release runtime theme registries after destruction it passes.
With Search API:
- Install Drupal 10.6.22 with Search API and any backend.
- Create an index on content with "Index items immediately" enabled, and add a "Rendered HTML output" field.
- Create or edit a node through the node form.
- The log shows "Theme hook ... not found." warnings (for example for
fieldandtime), and the indexed rendered output is missing what those hooks render.
Proposed resolution
Backport #3626105: Release runtime theme registries after destruction (main 96cfe41327b, 11.x 3325c73769b) to 10.6.x, and to 11.4.x and 11.3.x. It applies cleanly to 10.6.22, with the hunk in Registry.php at an offset. We tested it on 10.6.22: with it applied, our failing scenarios pass, and RegistryTest passes (13 tests).
Remaining tasks
- Merge request against 10.6.x with the backport.
- Review and commit; port to 11.4.x and 11.3.x.
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
Fixed a regression in 10.6.22 where code that renders late in a request, such as Search API indexing items immediately, logged "Theme hook ... not found." and rendered without theme output.
Comments
Comment #2
damienmckennaPer xjm in slack: