]> granicus.if.org Git - php/commitdiff
- Fixed bug #50185 (ldap_get_entries() return false instead of an empty array when...
authorJani Taskinen <jani@php.net>
Wed, 18 Nov 2009 17:44:58 +0000 (17:44 +0000)
committerJani Taskinen <jani@php.net>
Wed, 18 Nov 2009 17:44:58 +0000 (17:44 +0000)
# This is also revert of bad patch to bug #48469 and fixes it properly.

NEWS
ext/ldap/ldap.c

diff --git a/NEWS b/NEWS
index a81b95daac5cb85635643d7404a86a2384fc2566..6ed6ffca48e6c18997ade814046b2a3783be18f8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ PHP                                                                        NEWS
 
 - Fixed bug #50212 (crash by ldap_get_option() with LDAP_OPT_NETWORK_TIMEOUT).
   (Ilia, shigeru_kitazaki at cybozu dot co dot jp)
+- Fixed bug #50185 (ldap_get_entries() return false instead of an empty array
+  when there is no error). (Jani)
 - Fixed bug #50140 (With default compilation option, php symbols are
   unresolved for nsapi). (Uwe Schindler)
 - Fixed bug #50174 (Incorrectly matched docComment). (Felipe)
index e78236fde3085e00ce51f10f692cc8547beb66d6..c1ca6c2f42b463e1e200a122e42826d29b7c341f 100644 (file)
@@ -936,21 +936,21 @@ PHP_FUNCTION(ldap_get_entries)
        ldap = ld->link;
        num_entries = ldap_count_entries(ldap, ldap_result);
 
+       array_init(return_value);
+       add_assoc_long(return_value, "count", num_entries);
+
        if (num_entries == 0) {
-               RETURN_NULL();
+               return;
        }
-       num_entries = 0;
        
        ldap_result_entry = ldap_first_entry(ldap, ldap_result);
        if (ldap_result_entry == NULL) {
+               zval_dtor(return_value);
                RETURN_FALSE;
        }
 
-       array_init(return_value);
-       add_assoc_long(return_value, "count", num_entries);
-
+       num_entries = 0;
        while (ldap_result_entry != NULL) {
-
                MAKE_STD_ZVAL(tmp1);
                array_init(tmp1);