Skip to content

fix(workflowengine): only use the cached event list when it is an array - #67685

Open
kukanggg89 wants to merge 1 commit into
nextcloud:masterfrom
kukanggg89:fix-workflowengine-cached-events-type-67482
Open

kukanggg89 wants to merge 1 commit into
nextcloud:masterfrom
kukanggg89:fix-workflowengine-cached-events-type-67482

Conversation

@kukanggg89

Copy link
Copy Markdown
Contributor

Summary

Manager::getAllConfiguredEvents() returned whatever the distributed cache held for events as long as it was not null. A broken cache entry, false from APCu as in #54473, then threw a TypeError from the array return type while the app boots, so every request failed until the cache was cleared.

The method now only trusts the cached value when is_array($cached) is true. Anything else falls through to the database query, which re-populates the cache with the fresh list.

apps/workflowengine/tests/ManagerTest.php gets a new test, testGetAllConfiguredEventsIgnoresNonArrayCache: with the cache returning false, the method returns the one configured operation from the database instead of failing, and writes the rebuilt list back to the cache.

Verification: the new test was not run locally, there is no PHP on the machine this change was made on, so CI has to run it. The change is one condition, and the test follows the existing testGetAllConfiguredEvents setup in the same file.

TODO

No open TODOs.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Tests (unit, integration, api and/or acceptance) are included
  • Screenshots before/after for front-end changes (n/a: no front-end change)
  • Documentation (manuals or wiki) has been updated or is not required (n/a: bugfix, no user-facing behavior change beyond the fix)
  • Backports requested where applicable (ex: critical bugfixes) (n/a: bugfix, not critical)
  • Labels added where applicable (ex: bug/enhancement, 3. to review, feature component) (n/a: maintainers set labels)
  • Milestone added for target branch/version (ex: 32.x for stable32) (n/a: maintainers set the milestone)

AI (if applicable)

Drafted with help from Claude. I reviewed and revised every change myself before opening this PR.

getAllConfiguredEvents() returned whatever the distributed
cache held for 'events' as long as it was not null. A
broken cache entry (false from APCu, as in nextcloud#54473) then
threw a TypeError from the array return type while the
app boots, failing every request until the cache was
cleared. Only trust the cached value when it is an
array; anything else falls back to the database query
and re-populates the cache.

Fixes nextcloud#67482

Signed-off-by: parel <farelalfarizi89@gmail.com>

Assisted-by: Muse:Muse Spark 1.3
@kukanggg89
kukanggg89 requested a review from a team as a code owner December 4, 2026 07:34
@kukanggg89
kukanggg89 requested review from leftybournes and provokateurin and removed request for a team December 4, 2026 07:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow engine uses the cached event list without checking its type

1 participant