Fixed bug that prepareHandler cannot work sometimes for circuit-breaker. (#6419)

This commit is contained in:
szutoutou 2023-12-28 11:36:50 +08:00 committed by GitHub
parent c1b7d6ae42
commit 9ed7d0276e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,9 @@
# v3.1.4 - TBD
## Fixed
- [#6419](https://github.com/hyperf/hyperf/pull/6419) Fixed bug that `prepareHandler` cannot work sometimes for `circuit-breaker`.
## Optimized
- [#6415](https://github.com/hyperf/hyperf/pull/6415) Throw `InvalidArgumentException` instead of `TypeError` for decoding an empty string when using `Base62::decode`.

View File

@ -192,13 +192,13 @@ abstract class AbstractHandler implements HandlerInterface
{
if (is_string($fallback)) {
$fallback = explode('::', $fallback);
if (! isset($fallback[1]) && is_callable([$proceedingJoinPoint->className, $fallback[0]])) {
if (! isset($fallback[1]) && method_exists($proceedingJoinPoint->className, $fallback[0])) {
return [$proceedingJoinPoint->className, $fallback[0]];
}
$fallback[1] ??= 'fallback';
}
if (is_array($fallback) && is_callable($fallback)) {
if (is_array($fallback) && count($fallback) === 2) {
return $fallback;
}