summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2009-11-18 17:44:58 +0000
committerJani Taskinen <jani@php.net>2009-11-18 17:44:58 +0000
commit2ce1d0056d33444984663e53264d2584ec6a6f69 (patch)
treeb451e1c3fefdc78ba654fa3f93a28c13f9a7fbb1
parent9a7db580967d242a06227d9ffea756f5e555b1fa (diff)
downloadphp-git-2ce1d0056d33444984663e53264d2584ec6a6f69.tar.gz
- Fixed bug #50185 (ldap_get_entries() return false instead of an empty array when there is no error).
# This is also revert of bad patch to bug #48469 and fixes it properly.
-rw-r--r--NEWS2
-rw-r--r--ext/ldap/ldap.c18
2 files changed, 13 insertions, 7 deletions
diff --git a/NEWS b/NEWS
index fac6652f10..b29c0fe50f 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP NEWS
- Made it possible to disable post_max_size (Rasmus)
+- Fixed bug #50185 (ldap_get_entries() return false instead of an empty array
+ when there is no error). (Jani)
- Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
- Fixed bug #50158 (FILTER_VALIDATE_EMAIL fails with valid addresses
containing = or ?). (Pierrick)
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 32db2138f6..538ac7ce9f 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1061,17 +1061,21 @@ PHP_FUNCTION(ldap_get_entries)
ldap = ld->link;
num_entries = ldap_count_entries(ldap, ldap_result);
- if (num_entries == 0) return;
- num_entries = 0;
-
- ldap_result_entry = ldap_first_entry(ldap, ldap_result);
- if (ldap_result_entry == NULL) RETURN_FALSE;
-
array_init(return_value);
add_assoc_long(return_value, "count", num_entries);
- while (ldap_result_entry != NULL) {
+ if (num_entries == 0) {
+ return;
+ }
+
+ ldap_result_entry = ldap_first_entry(ldap, ldap_result);
+ if (ldap_result_entry == NULL) {
+ zval_dtor(return_value);
+ RETURN_FALSE;
+ }
+ num_entries = 0;
+ while (ldap_result_entry != NULL) {
MAKE_STD_ZVAL(tmp1);
array_init(tmp1);