From fc0b523ca8d2f04fd4f7664d0b36625b934211af Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 24 Feb 2022 15:56:14 +1100 Subject: [PATCH 1/4] Array dereference only allowed since PHP 5.4, whilst codebase specifies PHP 5.2 support --- src/LEConnector.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/LEConnector.php b/src/LEConnector.php index 1f3631e..05a8906 100644 --- a/src/LEConnector.php +++ b/src/LEConnector.php @@ -93,7 +93,8 @@ private function getLEDirectory() */ private function getNewNonce() { - if($this->head($this->newNonce)['status'] !== 200) throw LEConnectorException::NoNewNonceException(); + $head = $this->head($this->newNonce); + if($head['status'] !== 200) throw LEConnectorException::NoNewNonceException(); } /** From 72e8ba7ba0fb1af6824d75cdf6161df3449097ad Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 24 Feb 2022 15:59:13 +1100 Subject: [PATCH 2/4] Maintain PHP5 support: Class constant visibility is only allowed since PHP 7.1 --- src/Exceptions/LEAccountException.php | 2 +- src/Exceptions/LEAuthorizationException.php | 2 +- src/Exceptions/LEClientException.php | 4 ++-- src/Exceptions/LEConnectorException.php | 10 +++++----- src/Exceptions/LEFunctionsException.php | 6 +++--- src/Exceptions/LEOrderException.php | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Exceptions/LEAccountException.php b/src/Exceptions/LEAccountException.php index 1caf370..36e1729 100644 --- a/src/Exceptions/LEAccountException.php +++ b/src/Exceptions/LEAccountException.php @@ -37,7 +37,7 @@ */ class LEAccountException extends LEException { - public const ACCOUNTNOTFOUNDEEXCEPTION = 0x21; + const ACCOUNTNOTFOUNDEEXCEPTION = 0x21; public static function AccountNotFoundException() { diff --git a/src/Exceptions/LEAuthorizationException.php b/src/Exceptions/LEAuthorizationException.php index 51a0c45..d822a4e 100644 --- a/src/Exceptions/LEAuthorizationException.php +++ b/src/Exceptions/LEAuthorizationException.php @@ -37,7 +37,7 @@ */ class LEAuthorizationException extends LEException { - public const NOCHALLENGEFOUNDEEXCEPTION = 0x41; + const NOCHALLENGEFOUNDEEXCEPTION = 0x41; public static function NoChallengeFoundException($type, $identifier) { diff --git a/src/Exceptions/LEClientException.php b/src/Exceptions/LEClientException.php index 24a8c72..a98c714 100644 --- a/src/Exceptions/LEClientException.php +++ b/src/Exceptions/LEClientException.php @@ -37,8 +37,8 @@ */ class LEClientException extends LEException { - public const INVALIDARGUMENTEXCEPTION = 0x01; - public const INVALIDDIRECTORYEXCEPTION = 0x02; + const INVALIDARGUMENTEXCEPTION = 0x01; + const INVALIDDIRECTORYEXCEPTION = 0x02; public static function InvalidArgumentException(string $message) { diff --git a/src/Exceptions/LEConnectorException.php b/src/Exceptions/LEConnectorException.php index ff34e8a..a1d0fea 100644 --- a/src/Exceptions/LEConnectorException.php +++ b/src/Exceptions/LEConnectorException.php @@ -37,11 +37,11 @@ */ class LEConnectorException extends LEException { - public const NONEWNONCEEXCEPTION = 0x11; - public const ACCOUNTDEACTIVATEDEXCEPTION = 0x12; - public const METHODNOTSUPPORTEDEXCEPTION = 0x13; - public const CURLERROREXCEPTION = 0x14; - public const INVALIDRESPONSEEXCEPTION = 0x15; + const NONEWNONCEEXCEPTION = 0x11; + const ACCOUNTDEACTIVATEDEXCEPTION = 0x12; + const METHODNOTSUPPORTEDEXCEPTION = 0x13; + const CURLERROREXCEPTION = 0x14; + const INVALIDRESPONSEEXCEPTION = 0x15; public static function NoNewNonceException() { diff --git a/src/Exceptions/LEFunctionsException.php b/src/Exceptions/LEFunctionsException.php index 0cd3f5d..836c1f4 100644 --- a/src/Exceptions/LEFunctionsException.php +++ b/src/Exceptions/LEFunctionsException.php @@ -37,9 +37,9 @@ */ class LEFunctionsException extends LEException { - public const INVALIDARGUMENTEXCEPTION = 0x51; - public const GENERATEKEYPAIREXCEPTION = 0x52; - public const PHPVERSIONEXCEPTION = 0x53; + const INVALIDARGUMENTEXCEPTION = 0x51; + const GENERATEKEYPAIREXCEPTION = 0x52; + const PHPVERSIONEXCEPTION = 0x53; public static function InvalidArgumentException(string $message) { diff --git a/src/Exceptions/LEOrderException.php b/src/Exceptions/LEOrderException.php index ba24feb..a57a90f 100644 --- a/src/Exceptions/LEOrderException.php +++ b/src/Exceptions/LEOrderException.php @@ -37,11 +37,11 @@ */ class LEOrderException extends LEException { - public const INVALIDKEYTYPEEXCEPTION = 0x31; - public const INVALIDORDERSTATUSEXCEPTION = 0x32; - public const CREATEFAILEDEXCEPTION = 0x33; - public const INVALIDARGUMENTEXCEPTION = 0x34; - public const INVALIDCONFIGURATIONEXCEPTION = 0x35; + const INVALIDKEYTYPEEXCEPTION = 0x31; + const INVALIDORDERSTATUSEXCEPTION = 0x32; + const CREATEFAILEDEXCEPTION = 0x33; + const INVALIDARGUMENTEXCEPTION = 0x34; + const INVALIDCONFIGURATIONEXCEPTION = 0x35; public static function InvalidKeyTypeException(string $keyType) { From 50cfcccdfb1c2af77ffbe8897bcf3544a954cf8c Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 24 Feb 2022 16:01:12 +1100 Subject: [PATCH 3/4] Maintain PHP5 support: Remove array short syntax --- src/LEOrder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LEOrder.php b/src/LEOrder.php index 5ff5afe..7c0aa7d 100644 --- a/src/LEOrder.php +++ b/src/LEOrder.php @@ -844,10 +844,10 @@ private function validateCertificateResponse(array $response) { if(preg_match_all('~(-----BEGIN\sCERTIFICATE-----[\s\S]+?-----END\sCERTIFICATE-----)~i', $response['body'], $matches)) { - return [ + return array( 'leaf' => $matches[0][0], 'intermediate' => $matches[0][1], - ]; + ); } else { From bb7c73941a0abc044f5e0d77a3a32fa2baab1e1d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 24 Feb 2022 16:17:12 +1100 Subject: [PATCH 4/4] Maintain PHP5 support: Coercive typing for argument values evaluated as class type , only null default values supported. --- src/Exceptions/LEException.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Exceptions/LEException.php b/src/Exceptions/LEException.php index eccd792..b6a6922 100644 --- a/src/Exceptions/LEException.php +++ b/src/Exceptions/LEException.php @@ -39,7 +39,7 @@ class LEException extends \RuntimeException { protected $responsedata; - public function __construct(string $message = "", int $code = 0, Throwable $previous = NULL, array $responsedata = NULL) + public function __construct($message = "", $code = 0, $previous = NULL, $responsedata = NULL) { parent::__construct($message, $code, $previous); $this->responsedata = $responsedata;