summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-04-16 11:37:27 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-05-16 18:32:46 (GMT)
commit9516e7538cbeb8f02b52ed08836c7a789ae15e86 (patch)
tree4e5ff41b3b36d5a54c7fb4ae9be45df9104bc508
parent10e24e306591a696b65f0919fa4e571535ce8963 (diff)
downloadkolab-wap-9516e7538cbeb8f02b52ed08836c7a789ae15e86.tar.gz
Fix PHP fatal errors when search_entries() returns false (on error ) (Bug #1756)
-rw-r--r--lib/Auth/LDAP.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index d3116c8..33f91f4 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -260,7 +260,7 @@ class LDAP extends Net_LDAP3 {
$result = $this->search_entries($this->config_get('root_dn'), '(objectclass=*)', 'sub', null, $search);
- if ($result->count() > 0) {
+ if ($result && $result->count() > 0) {
return $result->entries(TRUE);
} else {
return FALSE;
@@ -652,7 +652,7 @@ class LDAP extends Net_LDAP3 {
return array(
'list' => $entries,
- 'count' => $result->count()
+ 'count' => is_object($result) ? $result->count() : 0,
);
}
@@ -860,6 +860,10 @@ class LDAP extends Net_LDAP3 {
private function sort_and_slice(&$result, &$params)
{
+ if (!is_object($result)) {
+ return array();
+ }
+
$entries = $result->entries(true);
if ($this->vlv_active) {