jani Wed, 18 Nov 2009 17:44:58 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=290923
Log: - 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. Bugs: http://bugs.php.net/50185 (Open) ldap_get_entries() return false instead of an empty array when there is no error http://bugs.php.net/48469 (Closed) ldap_get_entries() memory leaks when used on a search yielding no results Changed paths: U php/php-src/branches/PHP_5_2/NEWS U php/php-src/branches/PHP_5_2/ext/ldap/ldap.c U php/php-src/branches/PHP_5_3/NEWS U php/php-src/branches/PHP_5_3/ext/ldap/ldap.c U php/php-src/trunk/ext/ldap/ldap.c Modified: php/php-src/branches/PHP_5_2/NEWS =================================================================== --- php/php-src/branches/PHP_5_2/NEWS 2009-11-18 17:35:00 UTC (rev 290922) +++ php/php-src/branches/PHP_5_2/NEWS 2009-11-18 17:44:58 UTC (rev 290923) @@ -5,6 +5,8 @@ - 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) Modified: php/php-src/branches/PHP_5_2/ext/ldap/ldap.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/ldap/ldap.c 2009-11-18 17:35:00 UTC (rev 290922) +++ php/php-src/branches/PHP_5_2/ext/ldap/ldap.c 2009-11-18 17:44:58 UTC (rev 290923) @@ -1061,17 +1061,21 @@ ldap = ld->link; num_entries = ldap_count_entries(ldap, ldap_result); - if (num_entries == 0) return; - num_entries = 0; + array_init(return_value); + add_assoc_long(return_value, "count", num_entries); + + if (num_entries == 0) { + return; + } ldap_result_entry = ldap_first_entry(ldap, ldap_result); - if (ldap_result_entry == NULL) RETURN_FALSE; + 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); Modified: php/php-src/branches/PHP_5_3/NEWS =================================================================== --- php/php-src/branches/PHP_5_3/NEWS 2009-11-18 17:35:00 UTC (rev 290922) +++ php/php-src/branches/PHP_5_3/NEWS 2009-11-18 17:44:58 UTC (rev 290923) @@ -23,6 +23,8 @@ - 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) Modified: php/php-src/branches/PHP_5_3/ext/ldap/ldap.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/ldap/ldap.c 2009-11-18 17:35:00 UTC (rev 290922) +++ php/php-src/branches/PHP_5_3/ext/ldap/ldap.c 2009-11-18 17:44:58 UTC (rev 290923) @@ -936,21 +936,21 @@ 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); Modified: php/php-src/trunk/ext/ldap/ldap.c =================================================================== --- php/php-src/trunk/ext/ldap/ldap.c 2009-11-18 17:35:00 UTC (rev 290922) +++ php/php-src/trunk/ext/ldap/ldap.c 2009-11-18 17:44:58 UTC (rev 290923) @@ -957,21 +957,21 @@ 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);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
