Skip to content

fix(async): fail at once when a handler's method is not callable from outside - #54

Merged
ogorzalka merged 2 commits into
mainfrom
fix/non-public-handler-method-fails-at-resolution
Nov 25, 2026
Merged

ogorzalka merged 2 commits into
mainfrom
fix/non-public-handler-method-fails-at-resolution

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Branch: fix/non-public-handler-method-fails-at-resolution (base main at 22bc9be). Found by PHPStan level 7 (CallableDescriptor::resolve() returns an array it cannot prove callable).

Bug

CallableDescriptor::resolve('Class@method') checked method_exists() only. A private or protected method passes it, so the "callable" returned was not callable from outside; AsyncRunner::call() then threw BadFunctionCallException inside the call, which retryOrFail() treats as a transient failure: the execution was retried as many times as tries allowed, failing the same way each time.

Fix

resolve() checks is_callable() on the pair (so __call/__callStatic handlers still resolve) and throws UnresolvableHandler::notPublicMethod() (new named factory) otherwise. AsyncRunner::run() already routes resolution errors to fail(), with no retry.

Proof

New test in CallableDescriptorTest (a class with a protected method): fails without the fix (resolve returned an uncallable array), passes with it. 553 pass + 1 incomplete (on main too). CHANGELOG [Unreleased] / Fixed added.

Not verified

Retry behaviour end to end was not re-run in WordPress; the claim that the old path retried comes from reading AsyncRunner::run()/retryOrFail(), not from a failing test of the retry count. Semgrep not run.

@ogorzalka
ogorzalka merged commit 069a301 into main Nov 25, 2026
15 checks 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