From 11332ed1f987b53458b8020441b38e58e48dbcd8 Mon Sep 17 00:00:00 2001 From: Steven Nguyen Date: Wed, 9 Jul 2025 22:10:17 -0700 Subject: [PATCH] chore: fix deprecation warning from passing null into json_decode --- app/controllers/api/account.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 99269f1f18..b87f68abc0 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1424,13 +1424,13 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') $name = ''; $nameOAuth = $oauth2->getUserName($accessToken); - $userParam = \json_decode($request->getParam('user'), true); + $userParam = $request->getParam('user'); if (!empty($nameOAuth)) { $name = $nameOAuth; - } elseif (is_array($userParam)) { - $nameParam = $userParam['name']; - if (is_array($nameParam) && isset($nameParam['firstName']) && isset($nameParam['lastName'])) { - $name = $nameParam['firstName'] . ' ' . $nameParam['lastName']; + } elseif ($userParam !== null) { + $user = \json_decode($userParam, true); + if (isset($user['name']['firstName']) && isset($user['name']['lastName'])) { + $name = $user['name']['firstName'] . ' ' . $user['name']['lastName']; } } $email = $oauth2->getUserEmail($accessToken); @@ -1748,8 +1748,6 @@ App::get('/v1/account/sessions/oauth2/:provider/redirect') $state['success']['query'] = URLParser::unparseQuery($query); $state['success'] = URLParser::unparse($state['success']); - $expire = DateTime::formatTz(DateTime::addSeconds(new \DateTime(), $duration)); - $response ->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->addHeader('Pragma', 'no-cache')