From 36db7a60f1650e7155cadefcfe01ff6c92e079cc Mon Sep 17 00:00:00 2001 From: Thijs Kinkhorst <thijs@kinkhorst.com> Date: Thu, 6 Jan 2022 20:19:07 +0100 Subject: [PATCH] Bugfix: persistent overrides options (#1555) Fix that persistent would override other database options. Closes: #1546 --- lib/SimpleSAML/Database.php | 4 ++-- lib/SimpleSAML/Metadata/SAMLBuilder.php | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/SimpleSAML/Database.php b/lib/SimpleSAML/Database.php index 8e267790e..01bd51eea 100644 --- a/lib/SimpleSAML/Database.php +++ b/lib/SimpleSAML/Database.php @@ -86,7 +86,7 @@ class Database { $driverOptions = $config->getArray('database.driver_options', []); if ($config->getBoolean('database.persistent', true)) { - $driverOptions = [PDO::ATTR_PERSISTENT => true]; + $driverOptions[PDO::ATTR_PERSISTENT] = true; } // connect to the primary @@ -136,7 +136,7 @@ class Database 'database.username' => $config->getString('database.username', null), 'database.password' => $config->getString('database.password', null), 'database.prefix' => $config->getString('database.prefix', ''), - 'database.persistent' => $config->getBoolean('database.persistent', false), + 'database.persistent' => $config->getBoolean('database.persistent', true), ], // TODO: deprecated: the "database.slave" terminology is preserved here for backwards compatibility. 'secondaries' => $config->getArray('database.secondaries', $config->getArray('database.slaves', [])), diff --git a/lib/SimpleSAML/Metadata/SAMLBuilder.php b/lib/SimpleSAML/Metadata/SAMLBuilder.php index 91f39443a..f0f96a0a3 100644 --- a/lib/SimpleSAML/Metadata/SAMLBuilder.php +++ b/lib/SimpleSAML/Metadata/SAMLBuilder.php @@ -681,10 +681,15 @@ class SAMLBuilder * @param \SAML2\XML\md\RoleDescriptor $rd The RoleDescriptor the certificate should be added to. * @param string $use The value of the 'use' attribute. * @param string $x509data The certificate data. - * @param string|null $keyName The name of the key. Should be valid for usage in an ID attribute, e.g. not start with a digit. + * @param string|null $keyName The name of the key. Should be valid for usage in an ID attribute, + * e.g. not start with a digit. */ - private function addX509KeyDescriptor(RoleDescriptor $rd, string $use, string $x509data, ?string $keyName = null): void - { + private function addX509KeyDescriptor( + RoleDescriptor $rd, + string $use, + string $x509data, + ?string $keyName = null + ): void { Assert::oneOf($use, ['encryption', 'signing']); $keyDescriptor = \SAML2\Utils::createKeyDescriptor($x509data, $keyName); -- GitLab