Skip to content

Commit d732f48

Browse files
committed
Fix GitHub API response handling after Framework Update
1 parent 033a4b7 commit d732f48

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

administrator/components/com_patchtester/src/Controller/StartfetchController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function execute($task): void
5252
// Make sure we can fetch the data from GitHub - throw an error on < 10 available requests
5353
try {
5454
$rateResponse = Helper::initializeGithub()->getRateLimit();
55-
$rate = json_decode($rateResponse->body);
55+
$rate = json_decode($rateResponse->getBody());
5656
} catch (\Exception $e) {
5757
$response = new JsonResponse(new \Exception(Text::sprintf('COM_PATCHTESTER_COULD_NOT_CONNECT_TO_GITHUB', $e->getMessage()), $e->getCode(), $e));
5858
$this->app->sendHeaders();

administrator/components/com_patchtester/src/GitHub/GitHub.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Patch testing component for the Joomla! CMS
55
*
6-
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
6+
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2025 Open Source Matters, Inc. All rights reserved.
77
* @license GNU General Public License version 2 or later
88
*/
99

@@ -166,15 +166,15 @@ protected function processResponse(
166166
int $expectedCode = 200
167167
): Response {
168168
// Validate the response code.
169-
if ($response->code != $expectedCode) {
169+
if ($response->getStatusCode() != $expectedCode) {
170170
// Decode the error response and throw an exception.
171-
$body = json_decode($response->body);
171+
$body = json_decode((string) $response->getBody(), true);
172172
$error = $body->error ?? ($body->message ?? 'Unknown Error');
173173

174174
throw new UnexpectedResponse(
175175
$response,
176176
$error,
177-
$response->code
177+
$response->getStatusCode()
178178
);
179179
}
180180

0 commit comments

Comments
 (0)