From 453f927ac1b17ac35f2ca12d90f000e46bdf6896 Mon Sep 17 00:00:00 2001 From: Matt Schwager <schwag09@gmail.com> Date: Fri, 13 Apr 2018 16:17:48 -0400 Subject: [PATCH] PSR-2 lint fixes in lib/ directory --- lib/SimpleSAML/AuthMemCookie.php | 2 +- lib/SimpleSAML/IdP/IFrameLogoutHandler.php | 1 - lib/SimpleSAML/IdP/LogoutHandlerInterface.php | 1 - .../IdP/TraditionalLogoutHandler.php | 1 - lib/SimpleSAML/Locale/Localization.php | 1 - lib/SimpleSAML/Locale/Translate.php | 9 +- lib/SimpleSAML/Logger.php | 1 - lib/SimpleSAML/Memcache.php | 6 +- .../Metadata/MetaDataStorageHandler.php | 2 - .../Metadata/MetaDataStorageHandlerPdo.php | 1 - .../MetaDataStorageHandlerSerialize.php | 1 - .../Metadata/MetaDataStorageHandlerXML.php | 1 - .../Metadata/MetaDataStorageSource.php | 3 - lib/SimpleSAML/Metadata/SAMLBuilder.php | 3 +- lib/SimpleSAML/Metadata/SAMLParser.php | 14 +-- lib/SimpleSAML/Metadata/Signer.php | 5 +- lib/SimpleSAML/Session.php | 1 - lib/SimpleSAML/Stats.php | 1 - lib/SimpleSAML/Utils/Attributes.php | 1 - lib/SimpleSAML/Utils/Auth.php | 2 +- lib/SimpleSAML/Utils/Config/Metadata.php | 4 +- lib/SimpleSAML/Utils/HTTP.php | 4 +- lib/SimpleSAML/Utils/Random.php | 2 +- lib/SimpleSAML/Utils/Time.php | 1 - lib/SimpleSAML/XHTML/EMail.php | 93 ++++++++++--------- lib/SimpleSAML/XHTML/Template.php | 1 - .../XHTML/TemplateControllerInterface.php | 3 +- lib/SimpleSAML/XML/Validator.php | 3 +- 28 files changed, 72 insertions(+), 96 deletions(-) diff --git a/lib/SimpleSAML/AuthMemCookie.php b/lib/SimpleSAML/AuthMemCookie.php index 33944677e..21e3e4485 100644 --- a/lib/SimpleSAML/AuthMemCookie.php +++ b/lib/SimpleSAML/AuthMemCookie.php @@ -117,7 +117,7 @@ class SimpleSAML_AuthMemCookie $memcacheHost = $this->amcConfig->getString('memcache.host', '127.0.0.1'); $memcachePort = $this->amcConfig->getInteger('memcache.port', 11211); - $class = class_exists('Memcache') ? 'Memcache' : (class_exists('Memcached') ? 'Memcached' : FALSE); + $class = class_exists('Memcache') ? 'Memcache' : (class_exists('Memcached') ? 'Memcached' : false); if (!$class) { throw new Exception('Missing Memcached implementation. You must install either the Memcache or Memcached extension.'); } diff --git a/lib/SimpleSAML/IdP/IFrameLogoutHandler.php b/lib/SimpleSAML/IdP/IFrameLogoutHandler.php index 23a1daa85..b08440343 100644 --- a/lib/SimpleSAML/IdP/IFrameLogoutHandler.php +++ b/lib/SimpleSAML/IdP/IFrameLogoutHandler.php @@ -5,7 +5,6 @@ namespace SimpleSAML\IdP; use SimpleSAML\Module; use SimpleSAML\Utils\HTTP; - /** * Class that handles iframe logout. * diff --git a/lib/SimpleSAML/IdP/LogoutHandlerInterface.php b/lib/SimpleSAML/IdP/LogoutHandlerInterface.php index 11589f3d0..011dd63c6 100644 --- a/lib/SimpleSAML/IdP/LogoutHandlerInterface.php +++ b/lib/SimpleSAML/IdP/LogoutHandlerInterface.php @@ -2,7 +2,6 @@ namespace SimpleSAML\IdP; - /** * Interface that all logout handlers must implement. * diff --git a/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php b/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php index 61756f32e..105ac2796 100644 --- a/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php +++ b/lib/SimpleSAML/IdP/TraditionalLogoutHandler.php @@ -5,7 +5,6 @@ namespace SimpleSAML\IdP; use SimpleSAML\Logger; use SimpleSAML\Utils\HTTP; - /** * Class that handles traditional logout. * diff --git a/lib/SimpleSAML/Locale/Localization.php b/lib/SimpleSAML/Locale/Localization.php index cbfc42c30..9a023f9b4 100644 --- a/lib/SimpleSAML/Locale/Localization.php +++ b/lib/SimpleSAML/Locale/Localization.php @@ -262,5 +262,4 @@ class Localization { return $this->localeDomainMap; } - } diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php index 9cb0000bd..00ac6e5ee 100644 --- a/lib/SimpleSAML/Locale/Translate.php +++ b/lib/SimpleSAML/Locale/Translate.php @@ -259,9 +259,12 @@ class Translate public function t( $tag, $replacements = array(), - $fallbackdefault = true, // TODO: remove this for 2.0. Assume true - $oldreplacements = array(), // TODO: remove this for 2.0 - $striptags = false // TODO: remove this for 2.0 + // TODO: remove this for 2.0. Assume true + $fallbackdefault = true, + // TODO: remove this for 2.0 + $oldreplacements = array(), + // TODO: remove this for 2.0 + $striptags = false ) { $backtrace = debug_backtrace(); $where = $backtrace[0]['file'].':'.$backtrace[0]['line']; diff --git a/lib/SimpleSAML/Logger.php b/lib/SimpleSAML/Logger.php index a383addbd..dbda5c5c8 100644 --- a/lib/SimpleSAML/Logger.php +++ b/lib/SimpleSAML/Logger.php @@ -2,7 +2,6 @@ namespace SimpleSAML; - /** * The main logger class for SimpleSAMLphp. * diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php index 3d895755e..3f4bba004 100644 --- a/lib/SimpleSAML/Memcache.php +++ b/lib/SimpleSAML/Memcache.php @@ -164,8 +164,7 @@ class SimpleSAML_Memcache foreach (self::getMemcacheServers() as $server) { if (self::$extension === 'memcached') { $server->set($key, $savedInfoSerialized, $expire); - } - else { + } else { $server->set($key, $savedInfoSerialized, 0, $expire); } } @@ -310,7 +309,7 @@ class SimpleSAML_Memcache */ private static function loadMemcacheServerGroup(array $group) { - $class = class_exists('Memcache') ? 'Memcache' : (class_exists('Memcached') ? 'Memcached' : FALSE); + $class = class_exists('Memcache') ? 'Memcache' : (class_exists('Memcached') ? 'Memcached' : false); if (!$class) { throw new Exception('Missing Memcached implementation. You must install either the Memcache or Memcached extension.'); } @@ -490,5 +489,4 @@ class SimpleSAML_Memcache return $ret; } - } diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php index 95f232449..609147022 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandler.php @@ -280,7 +280,6 @@ class SimpleSAML_Metadata_MetaDataStorageHandler $metadata = $source->getMetaData($index, $set); if ($metadata !== null) { - if (array_key_exists('expire', $metadata)) { if ($metadata['expire'] < time()) { throw new Exception( @@ -347,7 +346,6 @@ class SimpleSAML_Metadata_MetaDataStorageHandler $result = array_merge($srcList, $result); } foreach ($result as $remote_provider) { - if (sha1($remote_provider['entityid']) == $sha1) { $remote_provider['metadata-set'] = $set; diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php index 0e3720e8b..f617c7e28 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php @@ -261,5 +261,4 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerPdo extends SimpleSAML_Metadata_ } return $stmt; } - } diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php index a9ec6f3c4..686791152 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerSerialize.php @@ -84,7 +84,6 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerSerialize extends SimpleSAML_Met } while (($entry = readdir($dh)) !== false) { - if ($entry[0] === '.') { // skip '..', '.' and hidden files continue; diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php index 44dba1fcf..7c537aa96 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerXML.php @@ -52,7 +52,6 @@ class SimpleSAML_Metadata_MetaDataStorageHandlerXML extends SimpleSAML_Metadata_ $entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsFile($src); foreach ($entities as $entityId => $entity) { - $md = $entity->getMetadata1xSP(); if ($md !== null) { $SP1x[$entityId] = $md; diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php index bc96feeec..c4e7161b4 100644 --- a/lib/SimpleSAML/Metadata/MetaDataStorageSource.php +++ b/lib/SimpleSAML/Metadata/MetaDataStorageSource.php @@ -139,7 +139,6 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource } foreach ($metadataSet as $index => $entry) { - if (!array_key_exists('host', $entry)) { continue; } @@ -177,7 +176,6 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource $metadataSet = $this->getMetadataSet($set); foreach ($metadataSet as $index => $entry) { - if (!array_key_exists('hint.cidr', $entry)) { continue; } @@ -262,5 +260,4 @@ abstract class SimpleSAML_Metadata_MetaDataStorageSource return null; } - } diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index c21df33a5..a868d5988 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -299,8 +299,7 @@ class SimpleSAML_Metadata_SAMLBuilder */ public function addOrganizationInfo(array $metadata) { - if ( - empty($metadata['OrganizationName']) || + if (empty($metadata['OrganizationName']) || empty($metadata['OrganizationDisplayName']) || empty($metadata['OrganizationURL']) ) { diff --git a/lib/SimpleSAML/Metadata/SAMLParser.php b/lib/SimpleSAML/Metadata/SAMLParser.php index 4ee7cdda0..280ca923d 100644 --- a/lib/SimpleSAML/Metadata/SAMLParser.php +++ b/lib/SimpleSAML/Metadata/SAMLParser.php @@ -211,7 +211,7 @@ class SimpleSAML_Metadata_SAMLParser try { $doc = \SAML2\DOMDocumentFactory::fromString($data); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new Exception('Failed to read XML from file: '.$file); } @@ -231,7 +231,7 @@ class SimpleSAML_Metadata_SAMLParser { try { $doc = \SAML2\DOMDocumentFactory::fromString($metadata); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new Exception('Failed to parse XML string.'); } @@ -292,7 +292,7 @@ class SimpleSAML_Metadata_SAMLParser try { $doc = \SAML2\DOMDocumentFactory::fromString($data); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new Exception('Failed to read XML from file: '.$file); } @@ -319,7 +319,7 @@ class SimpleSAML_Metadata_SAMLParser { try { $doc = \SAML2\DOMDocumentFactory::fromString($string); - } catch(\Exception $e) { + } catch (\Exception $e) { throw new Exception('Failed to parse XML string.'); } @@ -1007,7 +1007,6 @@ class SimpleSAML_Metadata_SAMLParser } foreach ($element->Extensions as $e) { - if ($e instanceof \SAML2\XML\shibmd\Scope) { $ret['scope'][] = $e->scope; continue; @@ -1016,8 +1015,6 @@ class SimpleSAML_Metadata_SAMLParser // Entity Attributes are only allowed at entity level extensions and not at RoleDescriptor level if ($element instanceof \SAML2\XML\md\EntityDescriptor || $element instanceof \SAML2\XML\md\EntitiesDescriptor) { - - if ($e instanceof \SAML2\XML\mdrpi\RegistrationInfo) { // Registration Authority cannot be overridden (warn only if override attempts to change the value) if (isset($ret['RegistrationInfo']['registrationAuthority']) @@ -1059,7 +1056,6 @@ class SimpleSAML_Metadata_SAMLParser // UIInfo elements are only allowed at RoleDescriptor level extensions if ($element instanceof \SAML2\XML\md\RoleDescriptor) { if ($e instanceof \SAML2\XML\mdui\UIInfo) { - $ret['UIInfo']['DisplayName'] = $e->DisplayName; $ret['UIInfo']['Description'] = $e->Description; $ret['UIInfo']['InformationURL'] = $e->InformationURL; @@ -1097,7 +1093,6 @@ class SimpleSAML_Metadata_SAMLParser // DiscoHints elements are only allowed at IDPSSODescriptor level extensions if ($element instanceof \SAML2\XML\md\IDPSSODescriptor) { - if ($e instanceof \SAML2\XML\mdui\DiscoHints) { $ret['DiscoHints']['IPHint'] = $e->IPHint; $ret['DiscoHints']['DomainHint'] = $e->DomainHint; @@ -1464,7 +1459,6 @@ class SimpleSAML_Metadata_SAMLParser $candidates = array(); foreach ($this->validators as $validator) { foreach ($validator->getValidatingCertificates() as $cert) { - $fp = strtolower(sha1(base64_decode($cert))); $candidates[] = $fp; if ($fp === $fingerprint) { diff --git a/lib/SimpleSAML/Metadata/Signer.php b/lib/SimpleSAML/Metadata/Signer.php index 3d3f2eaf9..6397a75da 100644 --- a/lib/SimpleSAML/Metadata/Signer.php +++ b/lib/SimpleSAML/Metadata/Signer.php @@ -28,11 +28,9 @@ class SimpleSAML_Metadata_Signer if (array_key_exists('metadata.sign.privatekey', $entityMetadata) || array_key_exists('metadata.sign.certificate', $entityMetadata) ) { - if (!array_key_exists('metadata.sign.privatekey', $entityMetadata) || !array_key_exists('metadata.sign.certificate', $entityMetadata) ) { - throw new Exception( 'Missing either the "metadata.sign.privatekey" or the'. ' "metadata.sign.certificate" configuration option in the metadata for'. @@ -79,7 +77,6 @@ class SimpleSAML_Metadata_Signer if (array_key_exists('privatekey', $entityMetadata) || array_key_exists('certificate', $entityMetadata) ) { - if (!array_key_exists('privatekey', $entityMetadata) || !array_key_exists('certificate', $entityMetadata) ) { @@ -246,7 +243,7 @@ class SimpleSAML_Metadata_Signer // convert the metadata to a DOM tree try { $xml = \SAML2\DOMDocumentFactory::fromString($metadataString); - } catch(Exception $e) { + } catch (Exception $e) { throw new Exception('Error parsing self-generated metadata.'); } diff --git a/lib/SimpleSAML/Session.php b/lib/SimpleSAML/Session.php index 50e6ad9e9..17e035732 100644 --- a/lib/SimpleSAML/Session.php +++ b/lib/SimpleSAML/Session.php @@ -631,7 +631,6 @@ class SimpleSAML_Session implements Serializable if (!$this->transient && (!empty($data['RememberMe']) || $this->rememberMeExpire) && $globalConfig->getBoolean('session.rememberme.enable', false) ) { - $this->setRememberMeExpire(); } else { try { diff --git a/lib/SimpleSAML/Stats.php b/lib/SimpleSAML/Stats.php index e710a373e..36b6f6626 100644 --- a/lib/SimpleSAML/Stats.php +++ b/lib/SimpleSAML/Stats.php @@ -97,5 +97,4 @@ class SimpleSAML_Stats $out->emit($data); } } - } diff --git a/lib/SimpleSAML/Utils/Attributes.php b/lib/SimpleSAML/Utils/Attributes.php index 00e934f5e..1f4941362 100644 --- a/lib/SimpleSAML/Utils/Attributes.php +++ b/lib/SimpleSAML/Utils/Attributes.php @@ -48,7 +48,6 @@ class Attributes if (count($attribute) === 0) { throw new \SimpleSAML_Error_Exception("Empty attribute '".$expected."'.'"); - } elseif (count($attribute) > 1) { if ($allow_multiple === false) { throw new \SimpleSAML_Error_Exception( diff --git a/lib/SimpleSAML/Utils/Auth.php b/lib/SimpleSAML/Utils/Auth.php index 5360f74da..cd2dbc29e 100644 --- a/lib/SimpleSAML/Utils/Auth.php +++ b/lib/SimpleSAML/Utils/Auth.php @@ -73,4 +73,4 @@ class Auth ); } } -} \ No newline at end of file +} diff --git a/lib/SimpleSAML/Utils/Config/Metadata.php b/lib/SimpleSAML/Utils/Config/Metadata.php index 632ec04cc..d1974308f 100644 --- a/lib/SimpleSAML/Utils/Config/Metadata.php +++ b/lib/SimpleSAML/Utils/Config/Metadata.php @@ -117,8 +117,8 @@ class Metadata // check attributes is an associative array if (isset($contact['attributes'])) { - if (empty($contact['attributes']) - || !is_array($contact['attributes']) + if (empty($contact['attributes']) + || !is_array($contact['attributes']) || count(array_filter(array_keys($contact['attributes']), 'is_string')) === 0 ) { throw new \InvalidArgumentException('"attributes" must be an array and cannot be empty.'); diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php index c839f4efd..06f4e0b37 100644 --- a/lib/SimpleSAML/Utils/HTTP.php +++ b/lib/SimpleSAML/Utils/HTTP.php @@ -599,8 +599,7 @@ class HTTP if (preg_match('#^https?://.*/?$#D', $baseURL, $matches)) { // full URL in baseurlpath, override local server values return rtrim($baseURL, '/').'/'; - } elseif ( - (preg_match('#^/?([^/]?.*/)$#D', $baseURL, $matches)) || + } elseif ((preg_match('#^/?([^/]?.*/)$#D', $baseURL, $matches)) || (preg_match('#^\*(.*)/$#D', $baseURL, $matches)) || ($baseURL === '') ) { @@ -796,7 +795,6 @@ class HTTP $hostname = parse_url($appurl, PHP_URL_HOST); $port = parse_url($appurl, PHP_URL_PORT); $port = !empty($port) ? ':'.$port : ''; - } else { // no base URL specified for app, just use the current URL $protocol = 'http'; $protocol .= (self::getServerHTTPS()) ? 's' : ''; diff --git a/lib/SimpleSAML/Utils/Random.php b/lib/SimpleSAML/Utils/Random.php index b53ace2e5..86937294e 100644 --- a/lib/SimpleSAML/Utils/Random.php +++ b/lib/SimpleSAML/Utils/Random.php @@ -27,4 +27,4 @@ class Random { return '_'.bin2hex(openssl_random_pseudo_bytes((int)((self::ID_LENGTH - 1)/2))); } -} \ No newline at end of file +} diff --git a/lib/SimpleSAML/Utils/Time.php b/lib/SimpleSAML/Utils/Time.php index be8d47b2d..21c005e50 100644 --- a/lib/SimpleSAML/Utils/Time.php +++ b/lib/SimpleSAML/Utils/Time.php @@ -9,7 +9,6 @@ namespace SimpleSAML\Utils; use SimpleSAML\Logger; - class Time { diff --git a/lib/SimpleSAML/XHTML/EMail.php b/lib/SimpleSAML/XHTML/EMail.php index 9638920e9..5796ec1c0 100644 --- a/lib/SimpleSAML/XHTML/EMail.php +++ b/lib/SimpleSAML/XHTML/EMail.php @@ -8,43 +8,44 @@ */ class SimpleSAML_XHTML_EMail { - private $to = null; - private $cc = null; - private $body = null; - private $from = null; - private $replyto = null; - private $subject = null; - private $headers = array(); - - - /** - * Constructor - */ - public function __construct($to, $subject, $from = null, $cc = null, $replyto = null) + private $to = null; + private $cc = null; + private $body = null; + private $from = null; + private $replyto = null; + private $subject = null; + private $headers = array(); + + + /** + * Constructor + */ + public function __construct($to, $subject, $from = null, $cc = null, $replyto = null) { - $this->to = $to; - $this->cc = $cc; - $this->from = $from; - $this->replyto = $replyto; - $this->subject = $subject; - } - - /* + $this->to = $to; + $this->cc = $cc; + $this->from = $from; + $this->replyto = $replyto; + $this->subject = $subject; + } + + /* * @param string $body * @return void */ public function setBody($body) { - $this->body = $body; - } + $this->body = $body; + } - /* + /* * @param string $body * @return void */ - private function getHTML($body) { - return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + private function getHTML($body) + { + return '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> @@ -68,32 +69,34 @@ pre { </div> </body> </html>'; - } + } /* * @return void */ - public function send() + public function send() { - if ($this->to === null) { + if ($this->to === null) { throw new Exception('EMail field [to] is required and not set.'); } elseif ($this->subject === null) { throw new Exception('EMail field [subject] is required and not set.'); } elseif ($this->body === null) { throw new Exception('EMail field [body] is required and not set.'); } - - $random_hash = bin2hex(openssl_random_pseudo_bytes(16)); - - if (isset($this->from)) - $this->headers[]= 'From: ' . $this->from; - if (isset($this->replyto)) - $this->headers[]= 'Reply-To: ' . $this->replyto; - - $this->headers[] = 'Content-Type: multipart/alternative; boundary="simplesamlphp-' . $random_hash . '"'; - - $message = ' + + $random_hash = bin2hex(openssl_random_pseudo_bytes(16)); + + if (isset($this->from)) { + $this->headers[]= 'From: ' . $this->from; + } + if (isset($this->replyto)) { + $this->headers[]= 'Reply-To: ' . $this->replyto; + } + + $this->headers[] = 'Content-Type: multipart/alternative; boundary="simplesamlphp-' . $random_hash . '"'; + + $message = ' --simplesamlphp-' . $random_hash . ' Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit @@ -108,12 +111,12 @@ Content-Transfer-Encoding: 8bit --simplesamlphp-' . $random_hash . '-- '; - $headers = implode("\n", $this->headers); + $headers = implode("\n", $this->headers); - $mail_sent = @mail($this->to, $this->subject, $message, $headers); - SimpleSAML\Logger::debug('Email: Sending e-mail to [' . $this->to . '] : ' . ($mail_sent ? 'OK' : 'Failed')); - if (!$mail_sent) { + $mail_sent = @mail($this->to, $this->subject, $message, $headers); + SimpleSAML\Logger::debug('Email: Sending e-mail to [' . $this->to . '] : ' . ($mail_sent ? 'OK' : 'Failed')); + if (!$mail_sent) { throw new Exception('Error when sending e-mail'); } - } + } } diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 1e5b65512..d23c95f43 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -313,7 +313,6 @@ class SimpleSAML_XHTML_Template $templatedir = $moduledir.'/templates'; if (!is_dir($templatedir)) { throw new InvalidArgumentException('The module \''.$module.'\' has no templates directory.'); - } return $templatedir; } diff --git a/lib/SimpleSAML/XHTML/TemplateControllerInterface.php b/lib/SimpleSAML/XHTML/TemplateControllerInterface.php index bd54907c4..8d6f4e733 100644 --- a/lib/SimpleSAML/XHTML/TemplateControllerInterface.php +++ b/lib/SimpleSAML/XHTML/TemplateControllerInterface.php @@ -7,7 +7,8 @@ namespace SimpleSAML\XHTML; * * @package SimpleSAMLphp */ -interface TemplateControllerInterface { +interface TemplateControllerInterface +{ /** * Implement to modify the twig environment after its initialization (e.g. add filters or extensions). diff --git a/lib/SimpleSAML/XML/Validator.php b/lib/SimpleSAML/XML/Validator.php index becf3516e..6d8a4f32a 100644 --- a/lib/SimpleSAML/XML/Validator.php +++ b/lib/SimpleSAML/XML/Validator.php @@ -325,7 +325,8 @@ class Validator assert(is_string($caFile)); // Clear openssl errors - while (openssl_error_string() !== false); + while (openssl_error_string() !== false) { + } $res = openssl_x509_checkpurpose($certificate, X509_PURPOSE_ANY, array($caFile)); -- GitLab