From aa29d0668b6c72b95594c1376cef533b5baace62 Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Thu, 4 Jan 2018 18:55:17 +0100 Subject: [PATCH] Fix type of ->certificate throughout class --- lib/SimpleSAML/XML/Signer.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/SimpleSAML/XML/Signer.php b/lib/SimpleSAML/XML/Signer.php index e4a04e05a..2c69e6b3f 100644 --- a/lib/SimpleSAML/XML/Signer.php +++ b/lib/SimpleSAML/XML/Signer.php @@ -31,9 +31,9 @@ class Signer private $privateKey = false; /** - * @var string|bool The certificate (as text). + * @var string The certificate (as text). */ - private $certificate = false; + private $certificate = ''; /** @@ -201,10 +201,11 @@ class Signer throw new \Exception('Could not find certificate file "' . $certFile . '".'); } - $this->certificate = file_get_contents($certFile); - if ($this->certificate === false) { + $cert = file_get_contents($certFile); + if ($cert === false) { throw new \Exception('Unable to read certificate file "' . $certFile . '".'); } + $this->certificate = $cert; } @@ -299,10 +300,8 @@ class Signer $objXMLSecDSig->sign($this->privateKey); - if ($this->certificate !== false) { - // Add the certificate to the signature - $objXMLSecDSig->add509Cert($this->certificate, true); - } + // Add the certificate to the signature + $objXMLSecDSig->add509Cert($this->certificate, true); // Add extra certificates foreach ($this->extraCertificates as $certificate) { -- GitLab