From 2c0ec24d2d533f2f04771edcc1eaa3c8fbd553fb Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 13 Mar 2024 15:07:40 +0100 Subject: [PATCH] Fix error message on openssl_error_string() failure --- Trustly/Api/api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Trustly/Api/api.php b/Trustly/Api/api.php index c9fee7d..f8e89e2 100644 --- a/Trustly/Api/api.php +++ b/Trustly/Api/api.php @@ -91,7 +91,7 @@ public function __construct($host='trustly.com', $port=443, $is_https=TRUE) { if($this->loadTrustlyPublicKey($host, $port, $is_https) === FALSE) { $error = openssl_error_string(); - throw new InvalidArgumentException("Cannot load Trustly public key file for host $host".(isset($error)?", error $error":'')); + throw new InvalidArgumentException("Cannot load Trustly public key file for host $host".($error?", error $error":'')); } /* Make sure the curl extension is loaded so we can open URL's */ @@ -264,7 +264,7 @@ public function setHost($host=NULL, $port=NULL, $is_https=NULL) { if($this->loadTrustlyPublicKey($host, $port) === FALSE) { $error = openssl_error_string(); - throw new InvalidArgumentException("Cannot load Trustly public key file for host $host".(isset($error)?", error $error":'')); + throw new InvalidArgumentException("Cannot load Trustly public key file for host $host".($error?", error $error":'')); } if(isset($is_https)) {