From: Jani Taskinen Date: Wed, 18 Nov 2009 17:44:58 +0000 (+0000) Subject: - Fixed bug #50185 (ldap_get_entries() return false instead of an empty array when... X-Git-Tag: php-5.3.2RC1~220 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b741b026a19b007955631bc5e665ab4ef25b7a54;p=php - 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. --- diff --git a/NEWS b/NEWS index a81b95daac..6ed6ffca48 100644 --- 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) diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index e78236fde3..c1ca6c2f42 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -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);