From 057526fd3dc90e7cd02d30d8422f4b004c49e996 Mon Sep 17 00:00:00 2001 From: Elijah Lynn <elijah@elijahlynn.net> Date: Wed, 23 Aug 2017 19:28:34 -0700 Subject: [PATCH] Make SQL options optional in examples. --- docs/simplesamlphp-customauth.md | 8 +++++--- modules/consent/lib/Consent/Store/Database.php | 2 +- modules/sqlauth/lib/Auth/Source/SQL.php | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/simplesamlphp-customauth.md b/docs/simplesamlphp-customauth.md index 8f0c2c042..8238ba695 100644 --- a/docs/simplesamlphp-customauth.md +++ b/docs/simplesamlphp-customauth.md @@ -273,9 +273,11 @@ The class follows: throw new Exception('Missing or invalid password option in config.'); } $this->password = $config['password']; - $this->options = $config['options']; - if (!is_array($config['options])) { - throw new Exception('Missing or invalid options option in config.'); + if (isset($config['options']) { + if (!is_array($config['options])) { + throw new Exception('Missing or invalid options option in config.'); + } + $this->options = $config['options']; } } diff --git a/modules/consent/lib/Consent/Store/Database.php b/modules/consent/lib/Consent/Store/Database.php index ff5993dad..0a99bfdba 100644 --- a/modules/consent/lib/Consent/Store/Database.php +++ b/modules/consent/lib/Consent/Store/Database.php @@ -485,7 +485,7 @@ class sspmod_consent_Consent_Store_Database extends sspmod_consent_Store $driver_options[PDO::ATTR_TIMEOUT] = $this->_timeout; } if (isset($this->_options)) { - array_merge($driver_options, $this->_options); + $this->_options = array_merge($driver_options, $this->_options); } else { $this->_options = $driver_options; } diff --git a/modules/sqlauth/lib/Auth/Source/SQL.php b/modules/sqlauth/lib/Auth/Source/SQL.php index 7f4694211..f1c6c773e 100644 --- a/modules/sqlauth/lib/Auth/Source/SQL.php +++ b/modules/sqlauth/lib/Auth/Source/SQL.php @@ -74,8 +74,10 @@ class sspmod_sqlauth_Auth_Source_SQL extends sspmod_core_Auth_UserPassBase { $this->dsn = $config['dsn']; $this->username = $config['username']; $this->password = $config['password']; - $this->options = $config['options']; $this->query = $config['query']; + if (isset($config['options'])) { + $this->options = $config['options']; + } } -- GitLab