mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-26 02:44:29 +00:00
Only set the cached instance if driver is valid
As I could see at other locations in the code, the ldap driver instance can be invalid. And if the instance is invalid, the getStaticLdap() function gets called again. Caching would prevent the function from retrying to initiate the ldapDrivers object. This commit adds conditional caching: only if the ldap driver instance is valid, the object gets cached. This ensures that a retry with this function would really try to create a new ldapDrivers object and not simply return the (invalid) cached one.
This commit is contained in:
parent
40c87435c1
commit
b732dcaeb3
@ -254,7 +254,10 @@ function getStaticLdap() {
|
||||
// If the instance is not there, create one
|
||||
if(!isset($instance)) {
|
||||
$ldapDrivers = new ldapDrivers($c->authenticate_hook['config']);
|
||||
$instance = $ldapDrivers
|
||||
|
||||
if ($ldapDrivers->valid) {
|
||||
$instance = $ldapDrivers
|
||||
}
|
||||
}
|
||||
else {
|
||||
$ldapDrivers = $instance
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user