Skip to content

Commit

Permalink
artemeon/core-ng#21858 fix: Deprecated utf8_encode function
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel committed Oct 24, 2024
1 parent d77ec52 commit eb57569
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/Client/Decorator/OAuth2/ClientCredentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/System/test_post_multipart.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
)
);
Expand Down

0 comments on commit eb57569

Please sign in to comment.