Skip to content

Commit 77ef94b

Browse files
author
Nayan Kumar S
committed
Amazon Pay API SDK PHP 2.6.5
1 parent 3adb8d2 commit 77ef94b

4 files changed

Lines changed: 36 additions & 6 deletions

File tree

Amazon/Pay/API/Client.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class Client implements ClientInterface, ReportingClientInterface, MerchantOnboardingClientInterface
1313
{
14-
const SDK_VERSION = '2.6.4';
14+
const SDK_VERSION = '2.6.5';
1515
const SDK_LANGUAGE = 'PHP';
1616
const HASH_ALGORITHM = 'sha256';
1717
const API_VERSION = 'v2';
@@ -322,7 +322,34 @@ protected function constructUserAgentHeader()
322322
{
323323
return 'amazon-pay-api-sdk-php/' . self::SDK_VERSION . ' ('
324324
. 'PHP/' . phpversion() . '; '
325-
. php_uname('s') . '/' . php_uname('m') . '/' . php_uname('r') . ')';
325+
. self::getPhpUname('s') . '/' . self::getPhpUname('m') . '/' . self::getPhpUname('r') . ')';
326+
}
327+
328+
/**
329+
* Retrieves system information using the php_uname function if it's enabled
330+
*
331+
* @param mode - A mode specifying the information to retrieve (e.g., 's' for the System name)
332+
* @return string - System information or '(disabled)' if php_uname is disabled
333+
*/
334+
public function getPhpUname($mode) {
335+
$uname_disabled = self::_isDisabled(ini_get('disable_functions'), 'php_uname');
336+
return $uname_disabled ? '(disabled)' : php_uname($mode);
337+
}
338+
339+
/**
340+
* Checks if a given function is disabled based on a comma-seperated string of disabled functions.
341+
*
342+
* @param string $disableFunctionsOutput - String value of the 'disable_function' setting, as output by ini_get('disable_functions')
343+
* @param string $functionName - Name of the function we are interesting in seeing whether or not it is disabled
344+
*
345+
* @return bool - True if the function is disabled, false otherwise
346+
*/
347+
private static function _isDisabled($disableFunctionsOutput, $functionName) {
348+
$disabledFunctions = explode(',', $disableFunctionsOutput);
349+
if(in_array($functionName, $disabledFunctions)) {
350+
return true;
351+
}
352+
return false;
326353
}
327354

328355
public function getPostSignedHeaders($http_request_method, $request_uri, $request_parameters, $request_payload, $other_presigned_headers = null)

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### Version 2.6.5 - March 2024
2+
* Avoid calling the php_uname function if it's disabled in the php.ini configuration
3+
14
### Version 2.6.4 - September 2023
25
* Introducing new Merchant Onboarding & Account Management APIs, which allows our partners to onboard merchants programatically and as part of account management offer them creation, updation and deletion/dissociation capability.
36
* Added the Sample Code snippets for the Charge APIs, Charge Permission APIs and Refund APIs.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ If you need to make an Amazon Pay API call that uses the mws.amazonservices.com|
77

88
## Requirements
99

10-
* PHP 5.5 or higher, but highly recommended to use only the latest PHP version, and update often, to ensure current security fixes are applied
10+
* PHP 5.6.1 or higher, but highly recommended to use only the latest PHP version, and update often, to ensure current security fixes are applied
1111
* Curl 7.18 or higher
12-
* phpseclib 2.0
12+
* phpseclib 3.0
1313

1414
## SDK Installation
1515

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "amzn/amazon-pay-api-sdk-php",
33
"type": "library",
44
"description": "Amazon Pay API SDK (PHP)",
5-
"version": "2.6.4",
5+
"version": "2.6.5",
66
"keywords": [
77
"amazon",
88
"pay",
@@ -27,7 +27,7 @@
2727
},
2828
"require": {
2929
"ext-curl": "*",
30-
"php": ">=5.5.0",
30+
"php": ">=5.6.1",
3131
"phpseclib/phpseclib": "~3.0"
3232
},
3333
"require-dev": {

0 commit comments

Comments
 (0)