From e01040a2e8d5658ef116e9606f2f383f8f3ea1db Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Fri, 29 Sep 2023 03:09:09 -0400 Subject: [PATCH] Remove $_SERVER superglobal dependency from Profile::addVisitorCookieForHTTPSigner --- src/Model/Profile.php | 8 +++++--- src/Module/Photo.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Model/Profile.php b/src/Model/Profile.php index b80c83881..9c7aab54a 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -813,12 +813,14 @@ class Profile /** * Set the visitor cookies (see remote_user()) for signed HTTP requests - ( + * + * @param array $server The content of the $_SERVER superglobal * @return array Visitor contact array + * @throws InternalServerErrorException */ - public static function addVisitorCookieForHTTPSigner(): array + public static function addVisitorCookieForHTTPSigner(array $server): array { - $requester = HTTPSignature::getSigner('', $_SERVER); + $requester = HTTPSignature::getSigner('', $server); if (empty($requester)) { return []; } diff --git a/src/Module/Photo.php b/src/Module/Photo.php index c8e0656d2..be2408edf 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -77,7 +77,7 @@ class Photo extends BaseApi throw new NotModifiedException(); } - Profile::addVisitorCookieForHTTPSigner(); + Profile::addVisitorCookieForHTTPSigner($this->server); $customsize = 0; $square_resize = true;