Skip to content

Commit bba72a9

Browse files
author
Igor Kuburovic
committed
Pull request #8: TSMD-23137 fixed deprecated function utf8_encode
Merge in SDK/php_telesign from feature/TSMD-23137_fix_deprecation_warning to master * commit 'cadd977de06f71f1e26f156f99226b18a1af0d8a': TSMD-23137 added dependency for mbstring TSMD-23137 changed utf8_encode function TSMD-23137 fixed deprecated function utf8_encode
2 parents 3f78b87 + cadd977 commit bba72a9

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

RELEASE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
3.0.2
2+
- Added dependency for extension mbstring
3+
- Fixed deprecated function utf8_encode() in RestClient.php, changed it with mb_convert_encoding()
4+
15
3.0.1
26
- Updated to fix support for PHP 8+
37

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
],
1717
"require": {
1818
"php": "^7.2.5 || ^8.0",
19+
"ext-mbstring": "*",
1920
"ext-xml": "*",
2021
"guzzlehttp/guzzle": "^7.0",
2122
"ramsey/uuid": "^4",

examples/callback_example/telesign_callback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function _log($log_level, $log_message) {
2626
// Generate a signature based on the contents of the callback request body signing with your API Secret Key.
2727
$postBody = file_get_contents('php://input');
2828
$signature = base64_encode(
29-
hash_hmac("sha256", utf8_encode($postBody), base64_decode(API_KEY), true)
29+
hash_hmac("sha256", mb_convert_encoding($postBody, "UTF-8", mb_detect_encoding($postBody)), base64_decode(API_KEY), true)
3030
);
3131
list($authType, $authToken) = explode(' ', getallheaders()['Authorization'], 2);
3232
list($requestCustomerID, $requestSignature) = explode(':', $authToken, 2);

src/rest/RestClient.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static function generateTelesignHeaders (
121121
$string_to_sign = join("", $string_to_sign_builder);
122122

123123
$signature = base64_encode(
124-
hash_hmac("sha256", utf8_encode($string_to_sign), base64_decode($api_key), true)
124+
hash_hmac("sha256", mb_convert_encoding($string_to_sign, "UTF-8", mb_detect_encoding($string_to_sign)), base64_decode($api_key), true)
125125
);
126126
$authorization = "TSA $customer_id:$signature";
127127

@@ -208,7 +208,6 @@ function delete (...$args) {
208208
*/
209209
protected function execute ($method_name, $resource, $fields = [], $date = null, $nonce = null) {
210210
$url_encoded_fields = http_build_query($fields, "", "&");
211-
212211
$headers = $this->generateTelesignHeaders(
213212
$this->customer_id,
214213
$this->api_key,

src/version/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
namespace telesign\sdk\version;
44

5-
const VERSION = "v3.0.1";
5+
const VERSION = "v3.0.2";

0 commit comments

Comments
 (0)