From eb57569371455497643ca5d84548d84def226cc0 Mon Sep 17 00:00:00 2001 From: Marc Reichel Date: Thu, 24 Oct 2024 10:18:28 +0200 Subject: [PATCH] artemeon/core-ng#21858 fix: Deprecated utf8_encode function --- src/Client/Decorator/OAuth2/ClientCredentials.php | 8 +++----- tests/System/test_post_multipart.php | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Client/Decorator/OAuth2/ClientCredentials.php b/src/Client/Decorator/OAuth2/ClientCredentials.php index e616620..fe9684e 100644 --- a/src/Client/Decorator/OAuth2/ClientCredentials.php +++ b/src/Client/Decorator/OAuth2/ClientCredentials.php @@ -13,8 +13,6 @@ namespace Artemeon\HttpClient\Client\Decorator\OAuth2; -use function utf8_encode; - /** * Class to generate client credentials for OAuth2 Access Token Request's */ @@ -34,9 +32,9 @@ class ClientCredentials private function __construct(string $clientID, string $clientSecret, string $scope = '') { // According to the rfc https://tools.ietf.org/html/rfc6749#page-43 encoding must UTF-8 - $this->clientId = utf8_encode($clientID); - $this->clientSecret = utf8_encode($clientSecret); - $this->scope = utf8_encode($scope); + $this->clientId = mb_convert_encoding($clientID, 'UTF-8', 'ISO-8859-1'); + $this->clientSecret = mb_convert_encoding($clientSecret, 'UTF-8', 'ISO-8859-1'); + $this->scope = mb_convert_encoding($scope, 'UTF-8', 'ISO-8859-1'); } /** diff --git a/tests/System/test_post_multipart.php b/tests/System/test_post_multipart.php index 23c1d74..3efcb97 100644 --- a/tests/System/test_post_multipart.php +++ b/tests/System/test_post_multipart.php @@ -29,7 +29,7 @@ Body::fromEncoder( MultipartFormDataEncoder::create() ->addFieldPart('user', 'John.Doe') - ->addFieldPart('password', utf8_encode('geheim')) + ->addFieldPart('password', mb_convert_encoding('geheim', 'UTF-8', 'ISO-8859-1')) ->addFilePart('user_image', 'header_logo.png', Stream::fromFile('../Fixtures/reader/header_logo.png')) ) );