Skip to content

fix(rest): skip middleware for method-mismatched permission checks#40

Merged
alexstandiford merged 1 commit into
mainfrom
fix/method-mismatch-permission-skip
Jun 12, 2026
Merged

fix(rest): skip middleware for method-mismatched permission checks#40
alexstandiford merged 1 commit into
mainfrom
fix/method-mismatch-permission-skip

Conversation

@alexstandiford

Copy link
Copy Markdown
Contributor

Follow-up to #39: the Allow-header pass still ran sibling-method middleware once per controller against a wrong-shaped request, producing null-param warnings and unbound-placeholder DB errors under WP_DEBUG (caught by Siren's fresh-install smoke walk). A controller whose method doesn't match the dispatching request can never run, so its permission check now returns true without executing the chain. New regression test; 68 tests green.

rest_send_allow_header invokes EVERY method's permission callback on the
matched route — including verbs that are not being dispatched. 4.3.2
isolated outcomes per controller but still ran each sibling method's
middleware once against a request shaped for a different verb, firing
validations with null params (foreach warnings, explode deprecations,
and WHERE-clause queries with unbound placeholders showing up as
WordPress database errors under WP_DEBUG).

A controller whose method doesn't match the actual request can never
dispatch, so its middleware outcome is irrelevant: advertise the method
and let a real request of that verb run its own chain.

Bumps version to 4.3.3.
@alexstandiford alexstandiford merged commit bce8152 into main Jun 12, 2026
1 check passed
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