diff options
Diffstat (limited to 'ext/ldap/ldap.c')
-rw-r--r-- | ext/ldap/ldap.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 4a8941cf1..c13912496 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2009 The PHP Group | + | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -23,7 +23,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ldap.c 287897 2009-08-30 15:33:59Z iliaa $ */ +/* $Id: ldap.c 293036 2010-01-03 09:23:27Z sebastian $ */ #define IS_EXT_MODULE #ifdef HAVE_CONFIG_H @@ -225,7 +225,7 @@ PHP_MINFO_FUNCTION(ldap) php_info_print_table_start(); php_info_print_table_row(2, "LDAP Support", "enabled"); - php_info_print_table_row(2, "RCS Version", "$Id: ldap.c 287897 2009-08-30 15:33:59Z iliaa $"); + php_info_print_table_row(2, "RCS Version", "$Id: ldap.c 293036 2010-01-03 09:23:27Z sebastian $"); if (LDAPG(max_links) == -1) { snprintf(tmp, 31, "%ld/unlimited", LDAPG(num_links)); @@ -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); @@ -1583,14 +1583,17 @@ PHP_FUNCTION(ldap_get_option) #ifdef LDAP_OPT_NETWORK_TIMEOUT case LDAP_OPT_NETWORK_TIMEOUT: { - struct timeval *timeout; + struct timeval *timeout = NULL; if (ldap_get_option(ld->link, LDAP_OPT_NETWORK_TIMEOUT, (void *) &timeout)) { if (timeout) { ldap_memfree(timeout); } RETURN_FALSE; - } + } + if (!timeout) { + RETURN_FALSE; + } zval_dtor(retval); ZVAL_LONG(retval, timeout->tv_sec); ldap_memfree(timeout); @@ -1908,6 +1911,7 @@ PHP_FUNCTION(ldap_first_reference) resultentry->id = Z_LVAL_P(result); zend_list_addref(resultentry->id); resultentry->data = entry; + resultentry->ber = NULL; } } /* }}} */ @@ -1936,6 +1940,7 @@ PHP_FUNCTION(ldap_next_reference) resultentry_next->id = resultentry->id; zend_list_addref(resultentry->id); resultentry_next->data = entry_next; + resultentry_next->ber = NULL; } } /* }}} */ |