|
26 | 26 | }; |
27 | 27 | use Psr\Log\{LoggerInterface, NullLogger}; |
28 | 28 | use ReflectionClass; |
29 | | -use function array_merge, array_shift, explode, implode, in_array, is_array, is_string, ltrim, |
| 29 | +use function array_key_exists, array_merge, array_shift, explode, implode, in_array, is_array, is_string, ltrim, |
30 | 30 | random_bytes, rtrim, sodium_bin2hex, sprintf, str_contains, str_starts_with, strip_tags, strtolower; |
31 | 31 | use const PHP_QUERY_RFC1738; |
32 | 32 |
|
@@ -515,12 +515,21 @@ final protected function handleMeResponseError(ResponseInterface $response):void |
515 | 515 | // let's try the common fields |
516 | 516 | foreach(['error_description', 'message', 'error', 'meta', 'data', 'detail', 'status', 'text'] as $err){ |
517 | 517 |
|
518 | | - if(isset($json[$err]) && is_string($json[$err])){ |
| 518 | + if(!array_key_exists($err, $json)){ |
| 519 | + continue; |
| 520 | + } |
| 521 | + |
| 522 | + if(is_string($json[$err])){ |
519 | 523 | throw new ProviderException($json[$err]); |
520 | 524 | } |
521 | 525 | elseif(is_array($json[$err])){ |
522 | 526 | foreach(['message', 'error', 'errorDetail', 'developer_message', 'msg', 'code'] as $errDetail){ |
523 | | - if(isset($json[$err][$errDetail]) && is_string($json[$err][$errDetail])){ |
| 527 | + |
| 528 | + if(!array_key_exists($errDetail, $json[$err])){ |
| 529 | + continue; |
| 530 | + } |
| 531 | + |
| 532 | + if(is_string($json[$err][$errDetail])){ |
524 | 533 | throw new ProviderException($json[$err][$errDetail]); |
525 | 534 | } |
526 | 535 | } |
|
0 commit comments