Skip to content

fix: do not crash wp_cache_delete_multiple() on a key that cannot index its result - #18

Merged
ogorzalka merged 1 commit into
mainfrom
fix/delete-multiple-invalid-key
Nov 26, 2026
Merged

ogorzalka merged 1 commit into
mainfrom
fix/delete-multiple-invalid-key

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Branch: fix/delete-multiple-invalid-key (base main).

What was wrong

wp_cache_delete_multiple() given a key that is not an integer or a string (an array, for example) reported it through _doing_it_wrong() and then threw a TypeError while using it as an index of the result. get_multiple() already skips such keys.

The key is now left out of the result, and the other keys are deleted as before.

What this proves

  • The new test fails without the fix (TypeError at WordPressObjectCache.php:161) and passes with it.

What this does not prove

  • WordPress core's own WP_Object_Cache::delete_multiple() indexes the result the same way; this was found by reading types (PHPStan level 9), not from a report in production.
  • The Redis tests are skipped locally (no phpredis); CI runs them.
  • composer qa on this branch: only the tests gate fails, on ManagerTest (no phpredis here), as on main. Semgrep is not installed locally.

@ogorzalka
ogorzalka merged commit cd461d0 into main Nov 26, 2026
10 checks passed
@ogorzalka ogorzalka mentioned this pull request Nov 27, 2026
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.

1 participant