diff options
Diffstat (limited to 'ext/ldap')
138 files changed, 1854 insertions, 2951 deletions
diff --git a/ext/ldap/config.m4 b/ext/ldap/config.m4 index f10cccc460..89c4b19531 100644 --- a/ext/ldap/config.m4 +++ b/ext/ldap/config.m4 @@ -51,7 +51,7 @@ PHP_ARG_WITH([ldap-sasl], if test "$PHP_LDAP" != "no"; then - PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,,-DLDAP_DEPRECATED=1 -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + PHP_NEW_EXTENSION(ldap, ldap.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) if test "$PHP_LDAP" = "yes"; then for i in /usr/local /usr; do diff --git a/ext/ldap/config.w32 b/ext/ldap/config.w32 index b947aa5177..1cbbfb8ba8 100644 --- a/ext/ldap/config.w32 +++ b/ext/ldap/config.w32 @@ -17,7 +17,6 @@ if (PHP_LDAP != "no") { AC_DEFINE('HAVE_LDAP_START_TLS_S', 1); AC_DEFINE('HAVE_LDAP', 1); AC_DEFINE('HAVE_LDAP_SASL', 1); - AC_DEFINE('LDAP_DEPRECATED', 1); AC_DEFINE('HAVE_LDAP_CONTROL_FIND', 1); AC_DEFINE('HAVE_LDAP_PARSE_EXTENDED_RESULT', 1); AC_DEFINE('HAVE_LDAP_EXTENDED_OPERATION_S', 1); diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 72a39bd93d..2983b857b6 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -35,11 +33,11 @@ #include "ext/standard/dl.h" #include "php_ldap.h" +#include "ldap_arginfo.h" #ifdef PHP_WIN32 #include <string.h> #include "config.w32.h" -#define strdup _strdup #undef WINDOWS #undef strcasecmp #undef strncasecmp @@ -264,7 +262,7 @@ static void _php_ldap_control_to_array(LDAP *ld, LDAPControl* ctrl, zval* array, add_assoc_long(&value, "target", target); add_assoc_long(&value, "count", count); add_assoc_long(&value, "errcode", errcode); - if ( context && (context->bv_len >= 0) ) { + if (context) { add_assoc_stringl(&value, "context", context->bv_val, context->bv_len); } add_assoc_zval(array, "value", &value); @@ -292,7 +290,7 @@ static int _php_ldap_control_from_array(LDAP *ld, LDAPControl** ctrl, zval* arra size_t num_tmpstrings1 = 0, num_tmpstrings2 = 0; if ((val = zend_hash_str_find(Z_ARRVAL_P(array), "oid", sizeof("oid") - 1)) == NULL) { - php_error_docref(NULL, E_WARNING, "Control must have an oid key"); + php_error_docref(NULL, E_WARNING, "Control must have an \"oid\" key"); return -1; } @@ -701,15 +699,13 @@ static void _php_ldap_controls_free (LDAPControl*** ctrls) } /* }}} */ -/* {{{ PHP_INI_BEGIN - */ +/* {{{ PHP_INI_BEGIN */ PHP_INI_BEGIN() STD_PHP_INI_ENTRY_EX("ldap.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong, max_links, zend_ldap_globals, ldap_globals, display_link_numbers) PHP_INI_END() /* }}} */ -/* {{{ PHP_GINIT_FUNCTION - */ +/* {{{ PHP_GINIT_FUNCTION */ static PHP_GINIT_FUNCTION(ldap) { #if defined(COMPILE_DL_LDAP) && defined(ZTS) @@ -719,8 +715,7 @@ static PHP_GINIT_FUNCTION(ldap) } /* }}} */ -/* {{{ PHP_MINIT_FUNCTION - */ +/* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(ldap) { REGISTER_INI_ENTRIES(); @@ -740,7 +735,7 @@ PHP_MINIT_FUNCTION(ldap) REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_MODTYPE", LDAP_MODIFY_BATCH_MODTYPE, CONST_PERSISTENT | CONST_CS); REGISTER_STRING_CONSTANT("LDAP_MODIFY_BATCH_VALUES", LDAP_MODIFY_BATCH_VALUES, CONST_PERSISTENT | CONST_CS); -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) /* LDAP options */ REGISTER_LONG_CONSTANT("LDAP_OPT_DEREF", LDAP_OPT_DEREF, CONST_PERSISTENT | CONST_CS); REGISTER_LONG_CONSTANT("LDAP_OPT_SIZELIMIT", LDAP_OPT_SIZELIMIT, CONST_PERSISTENT | CONST_CS); @@ -940,8 +935,7 @@ PHP_MINIT_FUNCTION(ldap) } /* }}} */ -/* {{{ PHP_MSHUTDOWN_FUNCTION - */ +/* {{{ PHP_MSHUTDOWN_FUNCTION */ PHP_MSHUTDOWN_FUNCTION(ldap) { UNREGISTER_INI_ENTRIES(); @@ -949,8 +943,7 @@ PHP_MSHUTDOWN_FUNCTION(ldap) } /* }}} */ -/* {{{ PHP_MINFO_FUNCTION - */ +/* {{{ PHP_MINFO_FUNCTION */ PHP_MINFO_FUNCTION(ldap) { char tmp[32]; @@ -988,8 +981,7 @@ PHP_MINFO_FUNCTION(ldap) } /* }}} */ -/* {{{ proto resource ldap_connect([string host [, int port [, string wallet [, string wallet_passwd [, int authmode]]]]]) - Connect to an LDAP server */ +/* {{{ Connect to an LDAP server */ PHP_FUNCTION(ldap_connect) { char *host = NULL; @@ -1010,7 +1002,7 @@ PHP_FUNCTION(ldap_connect) } if (zend_parse_parameters(ZEND_NUM_ARGS(), "|slssl", &host, &hostlen, &port, &wallet, &walletlen, &walletpasswd, &walletpasswdlen, &authmode) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } if (ZEND_NUM_ARGS() == 5) { @@ -1018,7 +1010,7 @@ PHP_FUNCTION(ldap_connect) } #else if (zend_parse_parameters(ZEND_NUM_ARGS(), "|sl", &host, &hostlen, &port) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } #endif @@ -1037,7 +1029,7 @@ PHP_FUNCTION(ldap_connect) if (port <= 0 || port > 65535) { efree(ld); - php_error_docref(NULL, E_WARNING, "invalid port number: " ZEND_LONG_FMT, port); + php_error_docref(NULL, E_WARNING, "Invalid port number: " ZEND_LONG_FMT, port); RETURN_FALSE; } @@ -1091,11 +1083,10 @@ PHP_FUNCTION(ldap_connect) } /* }}} */ -/* {{{ _get_lderrno - */ +/* {{{ _get_lderrno */ static int _get_lderrno(LDAP *ldap) { -#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP +#if LDAP_API_VERSION > 2000 || defined(HAVE_ORALDAP) int lderr; /* New versions of OpenLDAP do it this way */ @@ -1107,11 +1098,10 @@ static int _get_lderrno(LDAP *ldap) } /* }}} */ -/* {{{ _set_lderrno - */ +/* {{{ _set_lderrno */ static void _set_lderrno(LDAP *ldap, int lderr) { -#if LDAP_API_VERSION > 2000 || HAVE_ORALDAP +#if LDAP_API_VERSION > 2000 || defined(HAVE_ORALDAP) /* New versions of OpenLDAP do it this way */ ldap_set_option(ldap, LDAP_OPT_ERROR_NUMBER, &lderr); #else @@ -1120,8 +1110,7 @@ static void _set_lderrno(LDAP *ldap, int lderr) } /* }}} */ -/* {{{ proto bool ldap_bind(resource link [, string dn [, string password]]) - Bind to LDAP directory */ +/* {{{ Bind to LDAP directory */ PHP_FUNCTION(ldap_bind) { zval *link; @@ -1131,11 +1120,11 @@ PHP_FUNCTION(ldap_bind) int rc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ss", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) { @@ -1174,8 +1163,7 @@ PHP_FUNCTION(ldap_bind) } /* }}} */ -/* {{{ proto resource ldap_bind_ext(resource link [, string dn [, string password [, serverctrls]]]) - Bind to LDAP directory */ +/* {{{ Bind to LDAP directory */ PHP_FUNCTION(ldap_bind_ext) { zval *serverctrls = NULL; @@ -1188,11 +1176,11 @@ PHP_FUNCTION(ldap_bind_ext) int rc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|ssa", &link, &ldap_bind_dn, &ldap_bind_dnlen, &ldap_bind_pw, &ldap_bind_pwlen, &serverctrls) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (ldap_bind_dn != NULL && memchr(ldap_bind_dn, '\0', ldap_bind_dnlen) != NULL) { @@ -1260,8 +1248,7 @@ typedef struct { char *authzid; } php_ldap_bictx; -/* {{{ _php_sasl_setdefs - */ +/* {{{ _php_sasl_setdefs */ static php_ldap_bictx *_php_sasl_setdefs(LDAP *ld, char *sasl_mech, char *sasl_realm, char *sasl_authc_id, char *passwd, char *sasl_authz_id) { php_ldap_bictx *ctx; @@ -1290,8 +1277,7 @@ static php_ldap_bictx *_php_sasl_setdefs(LDAP *ld, char *sasl_mech, char *sasl_r } /* }}} */ -/* {{{ _php_sasl_freedefs - */ +/* {{{ _php_sasl_freedefs */ static void _php_sasl_freedefs(php_ldap_bictx *ctx) { if (ctx->mech) ber_memfree(ctx->mech); @@ -1336,8 +1322,7 @@ static int _php_sasl_interact(LDAP *ld, unsigned flags, void *defaults, void *in } /* }}} */ -/* {{{ proto bool ldap_sasl_bind(resource link [, string binddn [, string password [, string sasl_mech [, string sasl_realm [, string sasl_authc_id [, string sasl_authz_id [, string props]]]]]]]) - Bind to LDAP directory using SASL */ +/* {{{ Bind to LDAP directory using SASL */ PHP_FUNCTION(ldap_sasl_bind) { zval *link; @@ -1353,11 +1338,11 @@ PHP_FUNCTION(ldap_sasl_bind) php_ldap_bictx *ctx; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|sssssss", &link, &binddn, &dn_len, &passwd, &passwd_len, &sasl_mech, &mech_len, &sasl_realm, &realm_len, &sasl_authc_id, &authc_id_len, &sasl_authz_id, &authz_id_len, &props, &props_len) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } ctx = _php_sasl_setdefs(ld->link, sasl_mech, sasl_realm, sasl_authc_id, passwd, sasl_authz_id); @@ -1378,19 +1363,18 @@ PHP_FUNCTION(ldap_sasl_bind) /* }}} */ #endif /* HAVE_LDAP_SASL */ -/* {{{ proto bool ldap_unbind(resource link) - Unbind from LDAP directory */ +/* {{{ Unbind from LDAP directory */ PHP_FUNCTION(ldap_unbind) { zval *link; ldap_linkdata *ld; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } zend_list_close(Z_RES_P(link)); @@ -1398,13 +1382,12 @@ PHP_FUNCTION(ldap_unbind) } /* }}} */ -/* {{{ php_set_opts - */ +/* {{{ php_set_opts */ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, int *old_sizelimit, int *old_timelimit, int *old_deref) { /* sizelimit */ if (sizelimit > -1) { -#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP +#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP) ldap_get_option(ldap, LDAP_OPT_SIZELIMIT, old_sizelimit); ldap_set_option(ldap, LDAP_OPT_SIZELIMIT, &sizelimit); #else @@ -1415,7 +1398,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in /* timelimit */ if (timelimit > -1) { -#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP +#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP) ldap_get_option(ldap, LDAP_OPT_TIMELIMIT, old_timelimit); ldap_set_option(ldap, LDAP_OPT_TIMELIMIT, &timelimit); #else @@ -1426,7 +1409,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in /* deref */ if (deref > -1) { -#if (LDAP_API_VERSION >= 2004) || HAVE_ORALDAP +#if (LDAP_API_VERSION >= 2004) || defined(HAVE_ORALDAP) ldap_get_option(ldap, LDAP_OPT_DEREF, old_deref); ldap_set_option(ldap, LDAP_OPT_DEREF, &deref); #else @@ -1437,8 +1420,7 @@ static void php_set_opts(LDAP *ldap, int sizelimit, int timelimit, int deref, in } /* }}} */ -/* {{{ php_ldap_do_search - */ +/* {{{ php_ldap_do_search */ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) { zval *link, *base_dn, *filter, *attrs = NULL, *attr, *serverctrls = NULL; @@ -1454,7 +1436,7 @@ static void php_ldap_do_search(INTERNAL_FUNCTION_PARAMETERS, int scope) if (zend_parse_parameters(argcount, "zzz|a/lllla/", &link, &base_dn, &filter, &attrs, &attrsonly, &sizelimit, &timelimit, &deref, &serverctrls) == FAILURE) { - return; + RETURN_THROWS(); } /* Reverse -> fall through */ @@ -1690,43 +1672,39 @@ cleanup: } /* }}} */ -/* {{{ proto resource ldap_read(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref [, array servercontrols]]]]]]) - Read an entry */ +/* {{{ Read an entry */ PHP_FUNCTION(ldap_read) { php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_BASE); } /* }}} */ -/* {{{ proto resource ldap_list(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref [, array servercontrols]]]]]]) - Single-level search */ +/* {{{ Single-level search */ PHP_FUNCTION(ldap_list) { php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_ONELEVEL); } /* }}} */ -/* {{{ proto resource ldap_search(resource|array link, string base_dn, string filter [, array attrs [, int attrsonly [, int sizelimit [, int timelimit [, int deref [, array servercontrols]]]]]]) - Search LDAP tree under base_dn */ +/* {{{ Search LDAP tree under base_dn */ PHP_FUNCTION(ldap_search) { php_ldap_do_search(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_SCOPE_SUBTREE); } /* }}} */ -/* {{{ proto bool ldap_free_result(resource result) - Free result memory */ +/* {{{ Free result memory */ PHP_FUNCTION(ldap_free_result) { zval *result; LDAPMessage *ldap_result; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &result) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } zend_list_close(Z_RES_P(result)); /* Delete list entry */ @@ -1734,8 +1712,7 @@ PHP_FUNCTION(ldap_free_result) } /* }}} */ -/* {{{ proto int ldap_count_entries(resource link, resource result) - Count the number of entries in a search result */ +/* {{{ Count the number of entries in a search result */ PHP_FUNCTION(ldap_count_entries) { zval *link, *result; @@ -1743,23 +1720,22 @@ PHP_FUNCTION(ldap_count_entries) LDAPMessage *ldap_result; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } RETURN_LONG(ldap_count_entries(ld->link, ldap_result)); } /* }}} */ -/* {{{ proto resource ldap_first_entry(resource link, resource result) - Return first result id */ +/* {{{ Return first result id */ PHP_FUNCTION(ldap_first_entry) { zval *link, *result; @@ -1768,15 +1744,15 @@ PHP_FUNCTION(ldap_first_entry) LDAPMessage *ldap_result, *entry; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((entry = ldap_first_entry(ld->link, ldap_result)) == NULL) { @@ -1791,8 +1767,7 @@ PHP_FUNCTION(ldap_first_entry) } /* }}} */ -/* {{{ proto resource ldap_next_entry(resource link, resource result_entry) - Get next result entry */ +/* {{{ Get next result entry */ PHP_FUNCTION(ldap_next_entry) { zval *link, *result_entry; @@ -1801,14 +1776,14 @@ PHP_FUNCTION(ldap_next_entry) LDAPMessage *entry_next; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((entry_next = ldap_next_entry(ld->link, resultentry->data)) == NULL) { @@ -1823,8 +1798,7 @@ PHP_FUNCTION(ldap_next_entry) } /* }}} */ -/* {{{ proto array ldap_get_entries(resource link, resource result) - Get all result entries */ +/* {{{ Get all result entries */ PHP_FUNCTION(ldap_get_entries) { zval *link, *result; @@ -1840,14 +1814,14 @@ PHP_FUNCTION(ldap_get_entries) char *dn; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } ldap = ld->link; @@ -1889,12 +1863,12 @@ PHP_FUNCTION(ldap_get_entries) add_index_string(&tmp1, num_attrib, attribute); num_attrib++; -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(attribute); #endif attribute = ldap_next_attribute(ldap, ldap_result_entry, ber); } -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS if (ber != NULL) { ber_free(ber, 0); } @@ -1907,7 +1881,7 @@ PHP_FUNCTION(ldap_get_entries) } else { add_assoc_null(&tmp1, "dn"); } -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(dn); #else free(dn); @@ -1924,8 +1898,7 @@ PHP_FUNCTION(ldap_get_entries) } /* }}} */ -/* {{{ proto string ldap_first_attribute(resource link, resource result_entry) - Return first attribute */ +/* {{{ Return first attribute */ PHP_FUNCTION(ldap_first_attribute) { zval *link, *result_entry; @@ -1935,30 +1908,29 @@ PHP_FUNCTION(ldap_first_attribute) zend_long dummy_ber; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((attribute = ldap_first_attribute(ld->link, resultentry->data, &resultentry->ber)) == NULL) { RETURN_FALSE; } else { RETVAL_STRING(attribute); -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(attribute); #endif } } /* }}} */ -/* {{{ proto string ldap_next_attribute(resource link, resource result_entry) - Get the next attribute in result */ +/* {{{ Get the next attribute in result */ PHP_FUNCTION(ldap_next_attribute) { zval *link, *result_entry; @@ -1968,24 +1940,24 @@ PHP_FUNCTION(ldap_next_attribute) zend_long dummy_ber; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr|l", &link, &result_entry, &dummy_ber) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (resultentry->ber == NULL) { - php_error_docref(NULL, E_WARNING, "called before calling ldap_first_attribute() or no attributes found in result entry"); + php_error_docref(NULL, E_WARNING, "Called before calling ldap_first_attribute() or no attributes found in result entry"); RETURN_FALSE; } if ((attribute = ldap_next_attribute(ld->link, resultentry->data, resultentry->ber)) == NULL) { -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS if (resultentry->ber != NULL) { ber_free(resultentry->ber, 0); resultentry->ber = NULL; @@ -1994,15 +1966,14 @@ PHP_FUNCTION(ldap_next_attribute) RETURN_FALSE; } else { RETVAL_STRING(attribute); -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(attribute); #endif } } /* }}} */ -/* {{{ proto array ldap_get_attributes(resource link, resource result_entry) - Get attributes from a search result entry */ +/* {{{ Get attributes from a search result entry */ PHP_FUNCTION(ldap_get_attributes) { zval *link, *result_entry; @@ -2015,15 +1986,15 @@ PHP_FUNCTION(ldap_get_attributes) BerElement *ber; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } array_init(return_value); @@ -2045,12 +2016,12 @@ PHP_FUNCTION(ldap_get_attributes) add_index_string(return_value, num_attrib, attribute); num_attrib++; -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(attribute); #endif attribute = ldap_next_attribute(ld->link, resultentry->data, ber); } -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS if (ber != NULL) { ber_free(ber, 0); } @@ -2060,8 +2031,7 @@ PHP_FUNCTION(ldap_get_attributes) } /* }}} */ -/* {{{ proto array ldap_get_values_len(resource link, resource result_entry, string attribute) - Get all values with lengths from a result entry */ +/* {{{ Get all values with lengths from a result entry */ PHP_FUNCTION(ldap_get_values_len) { zval *link, *result_entry; @@ -2073,15 +2043,15 @@ PHP_FUNCTION(ldap_get_values_len) size_t attr_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link, &result_entry, &attr, &attr_len) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_value_len = ldap_get_values_len(ld->link, resultentry->data, attr)) == NULL) { @@ -2102,8 +2072,7 @@ PHP_FUNCTION(ldap_get_values_len) } /* }}} */ -/* {{{ proto string ldap_get_dn(resource link, resource result_entry) - Get the DN of a result entry */ +/* {{{ Get the DN of a result entry */ PHP_FUNCTION(ldap_get_dn) { zval *link, *result_entry; @@ -2112,21 +2081,21 @@ PHP_FUNCTION(ldap_get_dn) char *text; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } text = ldap_get_dn(ld->link, resultentry->data); if (text != NULL) { RETVAL_STRING(text); -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(text); #else free(text); @@ -2137,8 +2106,7 @@ PHP_FUNCTION(ldap_get_dn) } /* }}} */ -/* {{{ proto array ldap_explode_dn(string dn, int with_attrib) - Splits DN into its component parts */ +/* {{{ Splits DN into its component parts */ PHP_FUNCTION(ldap_explode_dn) { zend_long with_attrib; @@ -2147,7 +2115,7 @@ PHP_FUNCTION(ldap_explode_dn) size_t dn_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &dn, &dn_len, &with_attrib) != SUCCESS) { - return; + RETURN_THROWS(); } if (!(ldap_value = ldap_explode_dn(dn, with_attrib))) { @@ -2170,22 +2138,21 @@ PHP_FUNCTION(ldap_explode_dn) } /* }}} */ -/* {{{ proto string ldap_dn2ufn(string dn) - Convert DN to User Friendly Naming format */ +/* {{{ Convert DN to User Friendly Naming format */ PHP_FUNCTION(ldap_dn2ufn) { char *dn, *ufn; size_t dn_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &dn, &dn_len) != SUCCESS) { - return; + RETURN_THROWS(); } ufn = ldap_dn2ufn(dn); if (ufn != NULL) { RETVAL_STRING(ufn); -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP || WINDOWS +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) || WINDOWS ldap_memfree(ufn); #endif } else { @@ -2197,8 +2164,7 @@ PHP_FUNCTION(ldap_dn2ufn) /* added to fix use of ldap_modify_add for doing an ldap_add, gerrit thomson. */ #define PHP_LD_FULL_ADD 0xff -/* {{{ php_ldap_do_modify - */ +/* {{{ php_ldap_do_modify */ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext) { zval *serverctrls = NULL; @@ -2216,11 +2182,11 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext) int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/|a", &link, &dn, &dn_len, &entry, &serverctrls) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } num_attribs = zend_hash_num_elements(Z_ARRVAL_P(entry)); @@ -2375,8 +2341,7 @@ cleanup: } /* }}} */ -/* {{{ proto bool ldap_add(resource link, string dn, array entry [, array servercontrols]) - Add entries to LDAP directory */ +/* {{{ Add entries to LDAP directory */ PHP_FUNCTION(ldap_add) { /* use a newly define parameter into the do_modify so ldap_mod_add can be used the way it is supposed to be used , Gerrit THomson */ @@ -2384,8 +2349,7 @@ PHP_FUNCTION(ldap_add) } /* }}} */ -/* {{{ proto resource ldap_add_ext(resource link, string dn, array entry [, array servercontrols]) - Add entries to LDAP directory */ +/* {{{ Add entries to LDAP directory */ PHP_FUNCTION(ldap_add_ext) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LD_FULL_ADD, 1); @@ -2394,56 +2358,49 @@ PHP_FUNCTION(ldap_add_ext) /* three functions for attribute base modifications, gerrit Thomson */ -/* {{{ proto bool ldap_mod_replace(resource link, string dn, array entry [, array servercontrols]) - Replace attribute values with new ones */ +/* {{{ Replace attribute values with new ones */ PHP_FUNCTION(ldap_mod_replace) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE, 0); } /* }}} */ -/* {{{ proto resource ldap_mod_replace_ext(resource link, string dn, array entry [, array servercontrols]) - Replace attribute values with new ones */ +/* {{{ Replace attribute values with new ones */ PHP_FUNCTION(ldap_mod_replace_ext) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_REPLACE, 1); } /* }}} */ -/* {{{ proto bool ldap_mod_add(resource link, string dn, array entry [, array servercontrols]) - Add attribute values to current */ +/* {{{ Add attribute values to current */ PHP_FUNCTION(ldap_mod_add) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD, 0); } /* }}} */ -/* {{{ proto resource ldap_mod_add(resource link, string dn, array entry [, array servercontrols]) - Add attribute values to current */ +/* {{{ Add attribute values to current */ PHP_FUNCTION(ldap_mod_add_ext) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_ADD, 1); } /* }}} */ -/* {{{ proto bool ldap_mod_del(resource link, string dn, array entry [, array servercontrols]) - Delete attribute values */ +/* {{{ Delete attribute values */ PHP_FUNCTION(ldap_mod_del) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE, 0); } /* }}} */ -/* {{{ proto resource ldap_mod_del_ext(resource link, string dn, array entry [, array servercontrols]) - Delete attribute values */ +/* {{{ Delete attribute values */ PHP_FUNCTION(ldap_mod_del_ext) { php_ldap_do_modify(INTERNAL_FUNCTION_PARAM_PASSTHRU, LDAP_MOD_DELETE, 1); } /* }}} */ -/* {{{ php_ldap_do_delete - */ +/* {{{ php_ldap_do_delete */ static void php_ldap_do_delete(INTERNAL_FUNCTION_PARAMETERS, int ext) { zval *serverctrls = NULL; @@ -2456,11 +2413,11 @@ static void php_ldap_do_delete(INTERNAL_FUNCTION_PARAMETERS, int ext) size_t dn_len; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|a", &link, &dn, &dn_len, &serverctrls) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (serverctrls) { @@ -2503,24 +2460,21 @@ cleanup: } /* }}} */ -/* {{{ proto bool ldap_delete(resource link, string dn [, array servercontrols]) - Delete an entry from a directory */ +/* {{{ Delete an entry from a directory */ PHP_FUNCTION(ldap_delete) { php_ldap_do_delete(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto resource ldap_delete_ext(resource link, string dn [, array servercontrols]) - Delete an entry from a directory */ +/* {{{ Delete an entry from a directory */ PHP_FUNCTION(ldap_delete_ext) { php_ldap_do_delete(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } /* }}} */ -/* {{{ _ldap_str_equal_to_const - */ +/* {{{ _ldap_str_equal_to_const */ static size_t _ldap_str_equal_to_const(const char *str, size_t str_len, const char *cstr) { size_t i; @@ -2538,8 +2492,7 @@ static size_t _ldap_str_equal_to_const(const char *str, size_t str_len, const ch } /* }}} */ -/* {{{ _ldap_strlen_max - */ +/* {{{ _ldap_strlen_max */ static size_t _ldap_strlen_max(const char *str, size_t max_len) { size_t i; @@ -2554,16 +2507,14 @@ static size_t _ldap_strlen_max(const char *str, size_t max_len) } /* }}} */ -/* {{{ _ldap_hash_fetch - */ +/* {{{ _ldap_hash_fetch */ static void _ldap_hash_fetch(zval *hashTbl, const char *key, zval **out) { *out = zend_hash_str_find(Z_ARRVAL_P(hashTbl), key, strlen(key)); } /* }}} */ -/* {{{ proto bool ldap_modify_batch(resource link, string dn, array modifs [, array servercontrols]) - Perform multiple modifications as part of one operation */ +/* {{{ Perform multiple modifications as part of one operation */ PHP_FUNCTION(ldap_modify_batch) { zval *serverctrls = NULL; @@ -2605,11 +2556,11 @@ PHP_FUNCTION(ldap_modify_batch) */ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsa/|a", &link, &dn, &dn_len, &mods, &serverctrls) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } /* perform validation */ @@ -2880,41 +2831,38 @@ PHP_FUNCTION(ldap_modify_batch) } /* }}} */ -/* {{{ proto int ldap_errno(resource link) - Get the current ldap error number */ +/* {{{ Get the current ldap error number */ PHP_FUNCTION(ldap_errno) { zval *link; ldap_linkdata *ld; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } RETURN_LONG(_get_lderrno(ld->link)); } /* }}} */ -/* {{{ proto string ldap_err2str(int errno) - Convert error number to error string */ +/* {{{ Convert error number to error string */ PHP_FUNCTION(ldap_err2str) { zend_long perrno; if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &perrno) != SUCCESS) { - return; + RETURN_THROWS(); } RETURN_STRING(ldap_err2string(perrno)); } /* }}} */ -/* {{{ proto string ldap_error(resource link) - Get the current ldap error string */ +/* {{{ Get the current ldap error string */ PHP_FUNCTION(ldap_error) { zval *link; @@ -2922,11 +2870,11 @@ PHP_FUNCTION(ldap_error) int ld_errno; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } ld_errno = _get_lderrno(ld->link); @@ -2935,8 +2883,7 @@ PHP_FUNCTION(ldap_error) } /* }}} */ -/* {{{ proto bool ldap_compare(resource link, string dn, string attr, string value) - Determine if an entry has a specific value for one of its attributes */ +/* {{{ Determine if an entry has a specific value for one of its attributes */ PHP_FUNCTION(ldap_compare) { zval *serverctrls = NULL; @@ -2949,11 +2896,11 @@ PHP_FUNCTION(ldap_compare) struct berval lvalue; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsss|a", &link, &dn, &dn_len, &attr, &attr_len, &value, &value_len, &serverctrls) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (serverctrls) { @@ -2992,42 +2939,8 @@ cleanup: } /* }}} */ -/* {{{ proto bool ldap_sort(resource link, resource result, string sortfilter) - Sort LDAP result entries */ -PHP_FUNCTION(ldap_sort) -{ - zval *link, *result; - ldap_linkdata *ld; - char *sortfilter; - size_t sflen; - zend_resource *le; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrs", &link, &result, &sortfilter, &sflen) != SUCCESS) { - RETURN_FALSE; - } - - if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; - } - - le = Z_RES_P(result); - if (le->type != le_result) { - php_error_docref(NULL, E_WARNING, "Supplied resource is not a valid ldap result resource"); - RETURN_FALSE; - } - - if (ldap_sort_entries(ld->link, (LDAPMessage **) &le->ptr, sflen ? sortfilter : NULL, strcmp) != LDAP_SUCCESS) { - php_error_docref(NULL, E_WARNING, "%s", ldap_err2string(errno)); - RETURN_FALSE; - } - - RETURN_TRUE; -} -/* }}} */ - -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP -/* {{{ proto bool ldap_get_option(resource link, int option, mixed retval) - Get the current value of various session-wide parameters */ +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +/* {{{ Get the current value of various session-wide parameters */ PHP_FUNCTION(ldap_get_option) { zval *link, *retval; @@ -3035,11 +2948,11 @@ PHP_FUNCTION(ldap_get_option) zend_long option; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlz", &link, &option, &retval) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } switch (option) { @@ -3194,8 +3107,7 @@ PHP_FUNCTION(ldap_get_option) } /* }}} */ -/* {{{ proto bool ldap_set_option(resource link, int option, mixed newval) - Set the value of various session-wide parameters */ +/* {{{ Set the value of various session-wide parameters */ PHP_FUNCTION(ldap_set_option) { zval *link, *newval; @@ -3204,14 +3116,14 @@ PHP_FUNCTION(ldap_set_option) zend_long option; if (zend_parse_parameters(ZEND_NUM_ARGS(), "zlz", &link, &option, &newval) != SUCCESS) { - return; + RETURN_THROWS(); } if (Z_TYPE_P(link) == IS_NULL) { ldap = NULL; } else { if ((ld = (ldap_linkdata *)zend_fetch_resource_ex(link, "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } ldap = ld->link; } @@ -3322,7 +3234,7 @@ PHP_FUNCTION(ldap_set_option) zend_string *val; val = zval_get_string(newval); if (EG(exception)) { - RETURN_FALSE; + RETURN_THROWS(); } if (ldap_set_option(ldap, option, ZSTR_VAL(val))) { zend_string_release(val); @@ -3377,8 +3289,7 @@ PHP_FUNCTION(ldap_set_option) /* }}} */ #ifdef HAVE_LDAP_PARSE_RESULT -/* {{{ proto bool ldap_parse_result(resource link, resource result, int &errcode [, string &matcheddn [, string &errmsg [, array &referrals [, array &controls]]]]) - Extract information from result */ +/* {{{ Extract information from result */ PHP_FUNCTION(ldap_parse_result) { zval *link, *result, *errcode, *matcheddn, *errmsg, *referrals, *serverctrls; @@ -3390,15 +3301,15 @@ PHP_FUNCTION(ldap_parse_result) int rc, lerrcode, myargcount = ZEND_NUM_ARGS(); if (zend_parse_parameters(myargcount, "rrz|zzzz", &link, &result, &errcode, &matcheddn, &errmsg, &referrals, &serverctrls) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } rc = ldap_parse_result(ld->link, ldap_result, &lerrcode, @@ -3421,7 +3332,7 @@ PHP_FUNCTION(ldap_parse_result) case 6: referrals = zend_try_array_init(referrals); if (!referrals) { - return; + RETURN_THROWS(); } if (lreferrals != NULL) { refp = lreferrals; @@ -3453,8 +3364,7 @@ PHP_FUNCTION(ldap_parse_result) /* {{{ Extended operation response parsing, Pierangelo Masarati */ #ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT -/* {{{ proto bool ldap_parse_exop(resource link, resource result [, string &retdata [, string &retoid]]) - Extract information from extended operation result */ +/* {{{ Extract information from extended operation result */ PHP_FUNCTION(ldap_parse_exop) { zval *link, *result, *retdata, *retoid; @@ -3465,15 +3375,15 @@ PHP_FUNCTION(ldap_parse_exop) int rc, myargcount = ZEND_NUM_ARGS(); if (zend_parse_parameters(myargcount, "rr|zz", &link, &result, &retdata, &retoid) != SUCCESS) { - WRONG_PARAM_COUNT; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } rc = ldap_parse_extended_result(ld->link, ldap_result, @@ -3510,8 +3420,30 @@ PHP_FUNCTION(ldap_parse_exop) #endif /* }}} */ -/* {{{ proto resource ldap_first_reference(resource link, resource result) - Return first reference */ +/* {{{ Count the number of references in a search result */ +PHP_FUNCTION(ldap_count_references) +{ + zval *link, *result; + ldap_linkdata *ld; + LDAPMessage *ldap_result; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) { + RETURN_THROWS(); + } + + if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { + RETURN_THROWS(); + } + + if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { + RETURN_THROWS(); + } + + RETURN_LONG(ldap_count_references(ld->link, ldap_result)); +} +/* }}} */ + +/* {{{ Return first reference */ PHP_FUNCTION(ldap_first_reference) { zval *link, *result; @@ -3520,15 +3452,15 @@ PHP_FUNCTION(ldap_first_reference) LDAPMessage *ldap_result, *entry; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((entry = ldap_first_reference(ld->link, ldap_result)) == NULL) { @@ -3543,8 +3475,7 @@ PHP_FUNCTION(ldap_first_reference) } /* }}} */ -/* {{{ proto resource ldap_next_reference(resource link, resource reference_entry) - Get next reference */ +/* {{{ Get next reference */ PHP_FUNCTION(ldap_next_reference) { zval *link, *result_entry; @@ -3553,15 +3484,15 @@ PHP_FUNCTION(ldap_next_reference) LDAPMessage *entry_next; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &link, &result_entry) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((entry_next = ldap_next_reference(ld->link, resultentry->data)) == NULL) { @@ -3577,8 +3508,7 @@ PHP_FUNCTION(ldap_next_reference) /* }}} */ #ifdef HAVE_LDAP_PARSE_REFERENCE -/* {{{ proto bool ldap_parse_reference(resource link, resource reference_entry, array &referrals) - Extract information from reference entry */ +/* {{{ Extract information from reference entry */ PHP_FUNCTION(ldap_parse_reference) { zval *link, *result_entry, *referrals; @@ -3587,15 +3517,15 @@ PHP_FUNCTION(ldap_parse_reference) char **lreferrals, **refp; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rrz", &link, &result_entry, &referrals) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((resultentry = (ldap_resultentry *)zend_fetch_resource(Z_RES_P(result_entry), "ldap result entry", le_result_entry)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (ldap_parse_reference(ld->link, resultentry->data, &lreferrals, NULL /* &serverctrls */, 0) != LDAP_SUCCESS) { @@ -3604,7 +3534,7 @@ PHP_FUNCTION(ldap_parse_reference) referrals = zend_try_array_init(referrals); if (!referrals) { - return; + RETURN_THROWS(); } if (lreferrals != NULL) { @@ -3620,8 +3550,7 @@ PHP_FUNCTION(ldap_parse_reference) /* }}} */ #endif -/* {{{ php_ldap_do_rename - */ +/* {{{ php_ldap_do_rename */ static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext) { zval *serverctrls = NULL; @@ -3635,18 +3564,18 @@ static void php_ldap_do_rename(INTERNAL_FUNCTION_PARAMETERS, int ext) zend_bool deleteoldrdn; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsssb|a", &link, &dn, &dn_len, &newrdn, &newrdn_len, &newparent, &newparent_len, &deleteoldrdn, &serverctrls) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (newparent_len == 0) { newparent = NULL; } -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) if (serverctrls) { lserverctrls = _php_ldap_controls_from_array(ld->link, serverctrls); if (lserverctrls == NULL) { @@ -3702,16 +3631,14 @@ cleanup: } /* }}} */ -/* {{{ proto bool ldap_rename(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn [, array servercontrols]) - Modify the name of an entry */ +/* {{{ Modify the name of an entry */ PHP_FUNCTION(ldap_rename) { php_ldap_do_rename(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto resource ldap_rename_ext(resource link, string dn, string newrdn, string newparent, bool deleteoldrdn [, array servercontrols]) - Modify the name of an entry */ +/* {{{ Modify the name of an entry */ PHP_FUNCTION(ldap_rename_ext) { php_ldap_do_rename(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); @@ -3719,8 +3646,7 @@ PHP_FUNCTION(ldap_rename_ext) /* }}} */ #ifdef HAVE_LDAP_START_TLS_S -/* {{{ proto bool ldap_start_tls(resource link) - Start TLS */ +/* {{{ Start TLS */ PHP_FUNCTION(ldap_start_tls) { zval *link; @@ -3728,11 +3654,11 @@ PHP_FUNCTION(ldap_start_tls) int rc, protocol = LDAP_VERSION3; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (((rc = ldap_set_option(ld->link, LDAP_OPT_PROTOCOL_VERSION, &protocol)) != LDAP_SUCCESS) || @@ -3746,11 +3672,10 @@ PHP_FUNCTION(ldap_start_tls) } /* }}} */ #endif -#endif /* (LDAP_API_VERSION > 2000) || HAVE_ORALDAP */ +#endif /* (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) */ #if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) -/* {{{ _ldap_rebind_proc() -*/ +/* {{{ _ldap_rebind_proc() */ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgid, void *params) { ldap_linkdata *ld; @@ -3770,7 +3695,7 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi /* callback */ ZVAL_COPY_VALUE(&cb_args[0], cb_link); ZVAL_STRING(&cb_args[1], url); - if (call_user_function_ex(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args, 0, NULL) == SUCCESS && !Z_ISUNDEF(cb_retval)) { + if (call_user_function(EG(function_table), NULL, &ld->rebindproc, &cb_retval, 2, cb_args) == SUCCESS && !Z_ISUNDEF(cb_retval)) { retval = zval_get_long(&cb_retval); zval_ptr_dtor(&cb_retval); } else { @@ -3782,22 +3707,21 @@ int _ldap_rebind_proc(LDAP *ldap, const char *url, ber_tag_t req, ber_int_t msgi } /* }}} */ -/* {{{ proto bool ldap_set_rebind_proc(resource link, string callback) - Set a callback function to do re-binds on referral chasing. */ +/* {{{ Set a callback function to do re-binds on referral chasing. */ PHP_FUNCTION(ldap_set_rebind_proc) { zval *link, *callback; ldap_linkdata *ld; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &link, &callback) != SUCCESS) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } - if (Z_TYPE_P(callback) == IS_STRING && Z_STRLEN_P(callback) == 0) { + if (Z_TYPE_P(callback) == IS_NULL) { /* unregister rebind procedure */ if (!Z_ISUNDEF(ld->rebindproc)) { zval_ptr_dtor(&ld->rebindproc); @@ -3809,10 +3733,8 @@ PHP_FUNCTION(ldap_set_rebind_proc) /* callable? */ if (!zend_is_callable(callback, 0, NULL)) { - zend_string *callback_name = zend_get_callable_name(callback); - php_error_docref(NULL, E_WARNING, "Two arguments expected for '%s' to be a valid callback", ZSTR_VAL(callback_name)); - zend_string_release_ex(callback_name, 0); - RETURN_FALSE; + zend_argument_type_error(2, "must be a valid callback or null, %s given", zend_zval_type_name(callback)); + RETURN_THROWS(); } /* register rebind procedure */ @@ -3882,7 +3804,7 @@ PHP_FUNCTION(ldap_escape) zend_bool map[256] = {0}, havecharlist = 0; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|sl", &value, &valuelen, &ignores, &ignoreslen, &flags) != SUCCESS) { - return; + RETURN_THROWS(); } if (!valuelen) { @@ -3913,8 +3835,7 @@ PHP_FUNCTION(ldap_escape) } #ifdef STR_TRANSLATION -/* {{{ php_ldap_do_translate - */ +/* {{{ php_ldap_do_translate */ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way) { char *value; @@ -3922,7 +3843,7 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way) int result; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &value, &value_len) != SUCCESS) { - return; + RETURN_THROWS(); } if (value_len == 0) { @@ -3939,22 +3860,20 @@ static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way) RETVAL_STRINGL(value, value_len); free(value); } else { - php_error_docref(NULL, E_WARNING, "Conversion from iso-8859-1 to t61 failed: %s", ldap_err2string(result)); + php_error_docref(NULL, E_WARNING, "Conversion from ISO-8859-1 to t61 failed: %s", ldap_err2string(result)); RETVAL_FALSE; } } /* }}} */ -/* {{{ proto string ldap_t61_to_8859(string value) - Translate t61 characters to 8859 characters */ +/* {{{ Translate t61 characters to 8859 characters */ PHP_FUNCTION(ldap_t61_to_8859) { php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } /* }}} */ -/* {{{ proto string ldap_8859_to_t61(string value) - Translate 8859 characters to t61 characters */ +/* {{{ Translate 8859 characters to t61 characters */ PHP_FUNCTION(ldap_8859_to_t61) { php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); @@ -3963,8 +3882,7 @@ PHP_FUNCTION(ldap_8859_to_t61) #endif #ifdef LDAP_CONTROL_PAGEDRESULTS -/* {{{ proto mixed ldap_control_paged_result(resource link, int pagesize [, bool iscritical [, string cookie]]) - Inject paged results control*/ +/* {{{ Inject paged results control*/ PHP_FUNCTION(ldap_control_paged_result) { zend_long pagesize; @@ -3980,14 +3898,14 @@ PHP_FUNCTION(ldap_control_paged_result) int rc, myargcount = ZEND_NUM_ARGS(); if (zend_parse_parameters(myargcount, "rl|bs", &link, &pagesize, &iscritical, &cookie, &cookie_len) != SUCCESS) { - return; + RETURN_THROWS(); } if (Z_TYPE_P(link) == IS_NULL) { ldap = NULL; } else { if ((ld = (ldap_linkdata *)zend_fetch_resource_ex(link, "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } ldap = ld->link; } @@ -4057,8 +3975,7 @@ lcpr_error_out: } /* }}} */ -/* {{{ proto bool ldap_control_paged_result_response(resource link, resource result [, string &cookie [, int &estimated]]) - Extract paged results control response */ +/* {{{ Extract paged results control response */ PHP_FUNCTION(ldap_control_paged_result_response) { zval *link, *result, *cookie, *estimated; @@ -4072,15 +3989,15 @@ PHP_FUNCTION(ldap_control_paged_result_response) int rc, lerrcode, myargcount = ZEND_NUM_ARGS(); if (zend_parse_parameters(myargcount, "rr|zz", &link, &result, &cookie, &estimated) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if ((ldap_result = (LDAPMessage *)zend_fetch_resource(Z_RES_P(result), "ldap result", le_result)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } rc = ldap_parse_result(ld->link, @@ -4155,8 +4072,7 @@ PHP_FUNCTION(ldap_control_paged_result_response) /* {{{ Extended operations, Pierangelo Masarati */ #ifdef HAVE_LDAP_EXTENDED_OPERATION_S -/* {{{ proto resource ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, string &retdata [, string &retoid]]]]) - Extended operation */ +/* {{{ Extended operation */ PHP_FUNCTION(ldap_exop) { zval *serverctrls = NULL; @@ -4170,11 +4086,11 @@ PHP_FUNCTION(ldap_exop) int rc, msgid; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rS|S!a!zz", &link, &reqoid, &reqdata, &serverctrls, &retdata, &retoid) != SUCCESS) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } if (reqdata) { @@ -4258,8 +4174,7 @@ PHP_FUNCTION(ldap_exop) #endif #ifdef HAVE_LDAP_PASSWD -/* {{{ proto bool|string ldap_exop_passwd(resource link [, string user [, string oldpw [, string newpw [, array ctrls]]]]) - Passwd modify extended operation */ +/* {{{ Passwd modify extended operation */ PHP_FUNCTION(ldap_exop_passwd) { zval *link, *serverctrls; @@ -4274,12 +4189,11 @@ PHP_FUNCTION(ldap_exop_passwd) char* errmsg = NULL; if (zend_parse_parameters(myargcount, "r|sssz/", &link, &luser.bv_val, &luser.bv_len, &loldpw.bv_val, &loldpw.bv_len, &lnewpw.bv_val, &lnewpw.bv_len, &serverctrls) == FAILURE) { - return; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETVAL_FALSE; - goto cleanup; + RETURN_THROWS(); } switch (myargcount) { @@ -4362,8 +4276,7 @@ cleanup: #endif #ifdef HAVE_LDAP_WHOAMI_S -/* {{{ proto bool|string ldap_exop_whoami(resource link) - Whoami extended operation */ +/* {{{ Whoami extended operation */ PHP_FUNCTION(ldap_exop_whoami) { zval *link; @@ -4372,11 +4285,11 @@ PHP_FUNCTION(ldap_exop_whoami) int rc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &link) == FAILURE) { - WRONG_PARAM_COUNT; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } /* synchronous call */ @@ -4398,8 +4311,7 @@ PHP_FUNCTION(ldap_exop_whoami) #endif #ifdef HAVE_LDAP_REFRESH_S -/* {{{ proto bool|int ldap_exop_refresh(resource link , string dn , int ttl) - DDS refresh extended operation */ +/* {{{ DDS refresh extended operation */ PHP_FUNCTION(ldap_exop_refresh) { zval *link, *ttl; @@ -4410,11 +4322,11 @@ PHP_FUNCTION(ldap_exop_refresh) int rc; if (zend_parse_parameters(ZEND_NUM_ARGS(), "rsz", &link, &ldn.bv_val, &ldn.bv_len, &ttl) != SUCCESS) { - WRONG_PARAM_COUNT; + RETURN_THROWS(); } if ((ld = (ldap_linkdata *)zend_fetch_resource(Z_RES_P(link), "ldap link", le_link)) == NULL) { - RETURN_FALSE; + RETURN_THROWS(); } lttl = (ber_int_t)zval_get_long(ttl); @@ -4430,501 +4342,10 @@ PHP_FUNCTION(ldap_exop_refresh) /* }}} */ #endif -/* }}} */ - -/* {{{ arginfo */ -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0) - ZEND_ARG_INFO(0, hostname) - ZEND_ARG_INFO(0, port) -#ifdef HAVE_ORALDAP - ZEND_ARG_INFO(0, wallet) - ZEND_ARG_INFO(0, wallet_passwd) - ZEND_ARG_INFO(0, authmode) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_resource, 0, 0, 1) - ZEND_ARG_INFO(0, link_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind, 0, 0, 1) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, bind_rdn) - ZEND_ARG_INFO(0, bind_password) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, bind_rdn) - ZEND_ARG_INFO(0, bind_password) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -#ifdef HAVE_LDAP_SASL -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sasl_bind, 0, 0, 1) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, binddn) - ZEND_ARG_INFO(0, password) - ZEND_ARG_INFO(0, sasl_mech) - ZEND_ARG_INFO(0, sasl_realm) - ZEND_ARG_INFO(0, sasl_authz_id) - ZEND_ARG_INFO(0, props) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, base_dn) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_INFO(0, attributes) - ZEND_ARG_INFO(0, attrsonly) - ZEND_ARG_INFO(0, sizelimit) - ZEND_ARG_INFO(0, timelimit) - ZEND_ARG_INFO(0, deref) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_list, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, base_dn) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_INFO(0, attributes) - ZEND_ARG_INFO(0, attrsonly) - ZEND_ARG_INFO(0, sizelimit) - ZEND_ARG_INFO(0, timelimit) - ZEND_ARG_INFO(0, deref) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_search, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, base_dn) - ZEND_ARG_INFO(0, filter) - ZEND_ARG_INFO(0, attributes) - ZEND_ARG_INFO(0, attrsonly) - ZEND_ARG_INFO(0, sizelimit) - ZEND_ARG_INFO(0, timelimit) - ZEND_ARG_INFO(0, deref) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_count_entries, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_entry, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_entries, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_attribute, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_entry_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_attribute, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_entry_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_attributes, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_entry_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_entry_identifier) - ZEND_ARG_INFO(0, attribute) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_values_len, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_entry_identifier) - ZEND_ARG_INFO(0, attribute) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_dn, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, result_entry_identifier) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_explode_dn, 0, 0, 2) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, with_attrib) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_dn2ufn, 0, 0, 1) - ZEND_ARG_INFO(0, dn) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_modify_batch, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_ARRAY_INFO(0, modifications_info, 0) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_add_ext, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_replace_ext, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_mod_del_ext, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_err2str, 0, 0, 1) - ZEND_ARG_INFO(0, errno) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_compare, 0, 0, 4) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, attribute) - ZEND_ARG_INFO(0, value) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_sort, 0, 0, 3) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(0, sortfilter) -ZEND_END_ARG_INFO() - -#ifdef LDAP_CONTROL_PAGEDRESULTS -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result, 0, 0, 2) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, pagesize) - ZEND_ARG_INFO(0, iscritical) - ZEND_ARG_INFO(0, cookie) -ZEND_END_ARG_INFO(); - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 0, 2) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(1, cookie) - ZEND_ARG_INFO(1, estimated) -ZEND_END_ARG_INFO(); -#endif - -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename, 0, 0, 5) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, newrdn) - ZEND_ARG_INFO(0, newparent) - ZEND_ARG_INFO(0, deleteoldrdn) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, newrdn) - ZEND_ARG_INFO(0, newparent) - ZEND_ARG_INFO(0, deleteoldrdn) - ZEND_ARG_INFO(0, servercontrols) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_get_option, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, option) - ZEND_ARG_INFO(1, retval) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_option, 0, 0, 3) - ZEND_ARG_INFO(0, link_identifier) - ZEND_ARG_INFO(0, option) - ZEND_ARG_INFO(0, newval) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, result) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, entry) -ZEND_END_ARG_INFO() - -#ifdef HAVE_LDAP_PARSE_REFERENCE -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_reference, 0, 0, 3) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, entry) - ZEND_ARG_INFO(1, referrals) -ZEND_END_ARG_INFO() -#endif - - -#ifdef HAVE_LDAP_PARSE_RESULT -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_result, 0, 0, 3) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(1, errcode) - ZEND_ARG_INFO(1, matcheddn) - ZEND_ARG_INFO(1, errmsg) - ZEND_ARG_INFO(1, referrals) - ZEND_ARG_INFO(1, serverctrls) -ZEND_END_ARG_INFO() -#endif -#endif - -#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 0, 2) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, callback) -ZEND_END_ARG_INFO() -#endif - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_escape, 0, 0, 1) - ZEND_ARG_INFO(0, value) - ZEND_ARG_INFO(0, ignore) - ZEND_ARG_INFO(0, flags) -ZEND_END_ARG_INFO() - -#ifdef STR_TRANSLATION -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_t61_to_8859, 0, 0, 1) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_8859_to_t61, 0, 0, 1) - ZEND_ARG_INFO(0, value) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_LDAP_EXTENDED_OPERATION_S -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, reqoid) - ZEND_ARG_INFO(0, reqdata) - ZEND_ARG_INFO(0, servercontrols) - ZEND_ARG_INFO(1, retdata) - ZEND_ARG_INFO(1, retoid) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_LDAP_PASSWD -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_passwd, 0, 0, 1) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, user) - ZEND_ARG_INFO(0, oldpw) - ZEND_ARG_INFO(0, newpw) - ZEND_ARG_INFO(1, serverctrls) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_LDAP_WHOAMI_S -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_whoami, 0, 0, 1) - ZEND_ARG_INFO(0, link) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_LDAP_REFRESH_S -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop_refresh, 0, 0, 3) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, dn) - ZEND_ARG_INFO(0, ttl) -ZEND_END_ARG_INFO() -#endif - -#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT -ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_parse_exop, 0, 0, 4) - ZEND_ARG_INFO(0, link) - ZEND_ARG_INFO(0, result) - ZEND_ARG_INFO(1, retdata) - ZEND_ARG_INFO(1, retoid) -ZEND_END_ARG_INFO() -#endif -/* }}} */ - -/* - This is just a small subset of the functionality provided by the LDAP library. All the - operations are synchronous. Referrals are not handled automatically. -*/ -/* {{{ ldap_functions[] - */ -static const zend_function_entry ldap_functions[] = { - PHP_FE(ldap_connect, arginfo_ldap_connect) - PHP_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_resource) - PHP_FE(ldap_bind, arginfo_ldap_bind) - PHP_FE(ldap_bind_ext, arginfo_ldap_bind_ext) -#ifdef HAVE_LDAP_SASL - PHP_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind) -#endif - PHP_FE(ldap_unbind, arginfo_ldap_resource) - PHP_FE(ldap_read, arginfo_ldap_read) - PHP_FE(ldap_list, arginfo_ldap_list) - PHP_FE(ldap_search, arginfo_ldap_search) - PHP_FE(ldap_free_result, arginfo_ldap_resource) - PHP_FE(ldap_count_entries, arginfo_ldap_count_entries) - PHP_FE(ldap_first_entry, arginfo_ldap_first_entry) - PHP_FE(ldap_next_entry, arginfo_ldap_next_entry) - PHP_FE(ldap_get_entries, arginfo_ldap_get_entries) - PHP_FE(ldap_first_attribute, arginfo_ldap_first_attribute) - PHP_FE(ldap_next_attribute, arginfo_ldap_next_attribute) - PHP_FE(ldap_get_attributes, arginfo_ldap_get_attributes) - PHP_FALIAS(ldap_get_values, ldap_get_values_len, arginfo_ldap_get_values) - PHP_FE(ldap_get_values_len, arginfo_ldap_get_values_len) - PHP_FE(ldap_get_dn, arginfo_ldap_get_dn) - PHP_FE(ldap_explode_dn, arginfo_ldap_explode_dn) - PHP_FE(ldap_dn2ufn, arginfo_ldap_dn2ufn) - PHP_FE(ldap_add, arginfo_ldap_add) - PHP_FE(ldap_add_ext, arginfo_ldap_add_ext) - PHP_FE(ldap_delete, arginfo_ldap_delete) - PHP_FE(ldap_delete_ext, arginfo_ldap_delete_ext) - PHP_FE(ldap_modify_batch, arginfo_ldap_modify_batch) - PHP_FALIAS(ldap_modify, ldap_mod_replace, arginfo_ldap_modify) - -/* additional functions for attribute based modifications, Gerrit Thomson */ - PHP_FE(ldap_mod_add, arginfo_ldap_mod_add) - PHP_FE(ldap_mod_add_ext, arginfo_ldap_mod_add_ext) - PHP_FE(ldap_mod_replace, arginfo_ldap_mod_replace) - PHP_FE(ldap_mod_replace_ext, arginfo_ldap_mod_replace_ext) - PHP_FE(ldap_mod_del, arginfo_ldap_mod_del) - PHP_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext) -/* end gjt mod */ - - PHP_FE(ldap_errno, arginfo_ldap_resource) - PHP_FE(ldap_err2str, arginfo_ldap_err2str) - PHP_FE(ldap_error, arginfo_ldap_resource) - PHP_FE(ldap_compare, arginfo_ldap_compare) - PHP_DEP_FE(ldap_sort, arginfo_ldap_sort) - -#if (LDAP_API_VERSION > 2000) || HAVE_ORALDAP - PHP_FE(ldap_rename, arginfo_ldap_rename) - PHP_FE(ldap_rename_ext, arginfo_ldap_rename_ext) - PHP_FE(ldap_get_option, arginfo_ldap_get_option) - PHP_FE(ldap_set_option, arginfo_ldap_set_option) - PHP_FE(ldap_first_reference, arginfo_ldap_first_reference) - PHP_FE(ldap_next_reference, arginfo_ldap_next_reference) -#ifdef HAVE_LDAP_PARSE_REFERENCE - PHP_FE(ldap_parse_reference, arginfo_ldap_parse_reference) -#endif -#ifdef HAVE_LDAP_PARSE_RESULT - PHP_FE(ldap_parse_result, arginfo_ldap_parse_result) -#endif -#ifdef HAVE_LDAP_START_TLS_S - PHP_FE(ldap_start_tls, arginfo_ldap_resource) -#endif -#ifdef HAVE_LDAP_EXTENDED_OPERATION_S - PHP_FE(ldap_exop, arginfo_ldap_exop) -#endif -#ifdef HAVE_LDAP_PASSWD - PHP_FE(ldap_exop_passwd, arginfo_ldap_exop_passwd) -#endif -#ifdef HAVE_LDAP_WHOAMI_S - PHP_FE(ldap_exop_whoami, arginfo_ldap_exop_whoami) -#endif -#ifdef HAVE_LDAP_REFRESH_S - PHP_FE(ldap_exop_refresh, arginfo_ldap_exop_refresh) -#endif -#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT - PHP_FE(ldap_parse_exop, arginfo_ldap_parse_exop) -#endif -#endif - -#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) - PHP_FE(ldap_set_rebind_proc, arginfo_ldap_set_rebind_proc) -#endif - - PHP_FE(ldap_escape, arginfo_ldap_escape) - -#ifdef STR_TRANSLATION - PHP_FE(ldap_t61_to_8859, arginfo_ldap_t61_to_8859) - PHP_FE(ldap_8859_to_t61, arginfo_ldap_8859_to_t61) -#endif - -#ifdef LDAP_CONTROL_PAGEDRESULTS - PHP_DEP_FE(ldap_control_paged_result, arginfo_ldap_control_paged_result) - PHP_DEP_FE(ldap_control_paged_result_response, arginfo_ldap_control_paged_result_response) -#endif - PHP_FE_END -}; -/* }}} */ - zend_module_entry ldap_module_entry = { /* {{{ */ STANDARD_MODULE_HEADER, "ldap", - ldap_functions, + ext_functions, PHP_MINIT(ldap), PHP_MSHUTDOWN(ldap), NULL, diff --git a/ext/ldap/ldap.stub.php b/ext/ldap/ldap.stub.php new file mode 100644 index 0000000000..b60d46a70b --- /dev/null +++ b/ext/ldap/ldap.stub.php @@ -0,0 +1,318 @@ +<?php + +/** @generate-function-entries */ + +#ifdef HAVE_ORALDAP +/** @return resource|false */ +function ldap_connect(string $hostname = UNKNOWN, int $port = 389, string $wallet = UNKNOWN, string $wallet_passwd = UNKNOWN, int $authmode = GSLC_SSL_NO_AUTH) {} +#else +/** @return resource|false */ +function ldap_connect(string $hostname = UNKNOWN, int $port = 389) {} +#endif + +/** @param resource $link_identifier */ +function ldap_unbind($link_identifier): bool {} + +/** + * @param resource $link_identifier + * @alias ldap_unbind + */ +function ldap_close($link_identifier): bool {} + +/** @param resource $link_identifier */ +function ldap_bind($link_identifier, string $bind_rdn = UNKNOWN, string $bind_password = UNKNOWN): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_bind_ext($link_identifier, string $bind_rdn = UNKNOWN, string $bind_password = UNKNOWN, array $servercontrols = []) {} + +#ifdef HAVE_LDAP_SASL +/** @param resource $link */ +function ldap_sasl_bind($link, string $binddn = UNKNOWN, string $password = UNKNOWN, string $sasl_mech = UNKNOWN, string $sasl_realm = UNKNOWN, string $sasl_authc_id = UNKNOWN, string $sasl_authz_id = UNKNOWN, string $props = UNKNOWN): bool {} +#endif + +/** + * @param resource|array $link_identifier + * @param string|array $base_dn + * @param string|array $filter + * @return resource|false + */ +function ldap_read($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {} + +/** + * @param resource|array $link_identifier + * @param string|array $base_dn + * @param string|array $filter + * @return resource|false + */ +function ldap_list($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {} + +/** + * @param resource|array $link_identifier + * @param string|array $base_dn + * @param string|array $filter + * @return resource|false + */ +function ldap_search($link_identifier, $base_dn, $filter, array $attributes = [], int $attrsonly = 0, int $sizelimit = -1, int $timelimit = -1, int $deref = LDAP_DEREF_NEVER, array $servercontrols = []) {} + +/** @param resource $link_identifier */ +function ldap_free_result($link_identifier): bool {} + + +/** + * @param resource $link_identifier + * @param resource $result_identifier + */ +function ldap_count_entries($link_identifier, $result_identifier): int {} + +/** + * @param resource $link_identifier + * @param resource $result_identifier + * @return resource|false + */ +function ldap_first_entry($link_identifier, $result_identifier) {} + +/** + * @param resource $link_identifier + * @param resource $result_identifier + * @return resource|false + */ +function ldap_next_entry($link_identifier, $result_identifier) {} + +/** + * @param resource $link_identifier + * @param resource $result_identifier + */ +function ldap_get_entries($link_identifier, $result_identifier): array|false {} + +/** + * @param resource $link_identifier + * @param resource $result_entry_identifier + */ +function ldap_first_attribute($link_identifier, $result_entry_identifier, int $dummy_ber = UNKNOWN): string|false {} + +/** + * @param resource $link_identifier + * @param resource $result_entry_identifier + */ +function ldap_next_attribute($link_identifier, $result_entry_identifier, int $dummy_ber = UNKNOWN): string|false {} + +/** + * @param resource $link_identifier + * @param resource $result_entry_identifier + */ +function ldap_get_attributes($link_identifier, $result_entry_identifier): array {} + +/** + * @param resource $link_identifier + * @param resource $result_entry_identifier + */ +function ldap_get_values_len($link_identifier, $result_entry_identifier, string $attribute): array|false {} + +/** + * @param resource $link_identifier + * @param resource $result_entry_identifier + * @alias ldap_get_values_len + */ +function ldap_get_values($link_identifier, $result_entry_identifier, string $attribute): array|false {} + +/** + * @param resource $link_identifier + * @param resource $result_entry_identifier + */ +function ldap_get_dn($link_identifier, $result_entry_identifier): string|false {} + +function ldap_explode_dn(string $dn, int $with_attrib): array|false {} + +function ldap_dn2ufn(string $dn): string|false {} + +/** @param resource $link_identifier */ +function ldap_add($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_add_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {} + +/** @param resource $link_identifier */ +function ldap_delete($link_identifier, string $dn, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_delete_ext($link_identifier, string $dn, array $servercontrols = []) {} + +/** @param resource $link_identifier */ +function ldap_modify_batch($link_identifier, string $dn, array $modifications_info, array $servercontrols = []): bool {} + +/** @param resource $link_identifier */ +function ldap_mod_add($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_mod_add_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {} + +/** @param resource $link_identifier */ +function ldap_mod_replace($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @alias ldap_mod_replace + */ +function ldap_modify($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_mod_replace_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {} + +/** @param resource $link_identifier */ +function ldap_mod_del($link_identifier, string $dn, array $entry, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_mod_del_ext($link_identifier, string $dn, array $entry, array $servercontrols = []) {} + +/** @param resource $link */ +function ldap_errno($link): int {} + +/** @param resource $link */ +function ldap_error($link): string {} + +function ldap_err2str(int $errno): string {} + +/** @param resource $link_identifier */ +function ldap_compare($link_identifier, string $dn, string $attribute, string $value, array $servercontrols = []): bool|int {} + + +#ifdef LDAP_CONTROL_PAGEDRESULTS +/** + * @param resource $link + * @deprecated since 7.4 + */ +function ldap_control_paged_result($link, int $pagesize, bool $iscritical = false, string $cookie = ''): bool {} + +/** + * @param resource $link + * @param resource $result + * @deprecated since 7.4 + */ +function ldap_control_paged_result_response($link, $result, &$cookie = null, &$estimated = null): bool {} +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +/** @param resource $link_identifier */ +function ldap_rename($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []): bool {} + +/** + * @param resource $link_identifier + * @return resource|false + */ +function ldap_rename_ext($link_identifier, string $dn, string $newrdn, string $newparent, bool $deleteoldrdn, array $servercontrols = []) {} + + +/** @param resource $link_identifier */ +function ldap_get_option($link_identifier, int $option, &$retval = null): bool {} + +/** @param resource|null $link_identifier */ +function ldap_set_option($link_identifier, int $option, $newval): bool {} + +/** + * @param resource $link_identifier + * @param resource $result_identifier + */ +function ldap_count_references($link_identifier, $result_identifier): int {} + +/** + * @param resource $link + * @param resource $result + * @return resource|false + */ +function ldap_first_reference($link, $result) {} + +/** + * @param resource $link + * @param resource $entry + * @return resource|false + */ +function ldap_next_reference($link, $entry) {} + +#ifdef HAVE_LDAP_PARSE_REFERENCE +/** + * @param resource $link + * @param resource $entry + */ +function ldap_parse_reference($link, $entry, &$referrals): bool {} +#endif + +#ifdef HAVE_LDAP_PARSE_RESULT +/** + * @param resource $link + * @param resource $result + */ +function ldap_parse_result($link, $result, &$errcode, &$matcheddn = null, &$errmsg = null, &$referrals = null, &$serverctrls = null): bool {} +#endif +#endif + +#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) +/** + * @param resource $link + */ +function ldap_set_rebind_proc($link, ?callable $callback): bool {} +#endif + +#ifdef HAVE_LDAP_START_TLS_S +function ldap_start_tls($link_identifier): bool {} +#endif + +function ldap_escape(string $value, string $ignore = '', int $flags = 0): string {} + +#ifdef STR_TRANSLATION +function ldap_t61_to_8859(string $value): string|false {} + +function ldap_8859_to_t61(string $value): string|false {} +#endif + + +#ifdef HAVE_LDAP_EXTENDED_OPERATION_S +/** + * @param resource $link + * @return resource|bool + */ +function ldap_exop($link, string $reqoid, ?string $reqdata = null, ?array $servercontrols = [], &$retdata = null, &$retoid = null) {} +#endif + +#ifdef HAVE_LDAP_PASSWD +/** @param resource $link */ +function ldap_exop_passwd($link, string $user = '', string $oldpw = '', string $newpw = '', &$serverctrls = null): string|bool {} +#endif + + +#ifdef HAVE_LDAP_WHOAMI_S +/** @param resource $link */ +function ldap_exop_whoami($link): string|bool {} +#endif + + +#ifdef HAVE_LDAP_REFRESH_S +/** @param resource $link */ +function ldap_exop_refresh($link, string $dn, $ttl): int|false {} +#endif + + +#ifdef HAVE_LDAP_PARSE_EXTENDED_RESULT +/** + * @param resource $link + * @param resource $result + */ +function ldap_parse_exop($link, $result, &$retdata = null, &$retoid = null): bool {} +#endif diff --git a/ext/ldap/ldap_arginfo.h b/ext/ldap/ldap_arginfo.h new file mode 100644 index 0000000000..8aa72a0276 --- /dev/null +++ b/ext/ldap/ldap_arginfo.h @@ -0,0 +1,574 @@ +/* This is a generated file, edit the .stub.php file instead. + * Stub hash: 63d7fc9e11bd2821a77f6ee709ceaf1fdcbf190e */ + +#if defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "389") + ZEND_ARG_TYPE_INFO(0, wallet, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, wallet_passwd, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, authmode, IS_LONG, 0, "GSLC_SSL_NO_AUTH") +ZEND_END_ARG_INFO() +#endif + +#if !(defined(HAVE_ORALDAP)) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_connect, 0, 0, 0) + ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "389") +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_unbind, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) +ZEND_END_ARG_INFO() + +#define arginfo_ldap_close arginfo_ldap_unbind + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_bind, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, bind_rdn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, bind_password, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_bind_ext, 0, 0, 1) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, bind_rdn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, bind_password, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#if defined(HAVE_LDAP_SASL) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_sasl_bind, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_TYPE_INFO(0, binddn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, sasl_mech, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, sasl_realm, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, sasl_authc_id, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, sasl_authz_id, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, props, IS_STRING, 0) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_read, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, base_dn) + ZEND_ARG_INFO(0, filter) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, attributes, IS_ARRAY, 0, "[]") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, attrsonly, IS_LONG, 0, "0") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, sizelimit, IS_LONG, 0, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timelimit, IS_LONG, 0, "-1") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, deref, IS_LONG, 0, "LDAP_DEREF_NEVER") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#define arginfo_ldap_list arginfo_ldap_read + +#define arginfo_ldap_search arginfo_ldap_read + +#define arginfo_ldap_free_result arginfo_ldap_unbind + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_count_entries, 0, 2, IS_LONG, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_entry, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +#define arginfo_ldap_next_entry arginfo_ldap_first_entry + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_entries, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_first_attribute, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_entry_identifier) + ZEND_ARG_TYPE_INFO(0, dummy_ber, IS_LONG, 0) +ZEND_END_ARG_INFO() + +#define arginfo_ldap_next_attribute arginfo_ldap_first_attribute + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_attributes, 0, 2, IS_ARRAY, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_entry_identifier) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_values_len, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_entry_identifier) + ZEND_ARG_TYPE_INFO(0, attribute, IS_STRING, 0) +ZEND_END_ARG_INFO() + +#define arginfo_ldap_get_values arginfo_ldap_get_values_len + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_get_dn, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_entry_identifier) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_explode_dn, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, with_attrib, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_dn2ufn, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_add, 0, 3, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, entry, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_add_ext, 0, 0, 3) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, entry, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_delete, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_delete_ext, 0, 0, 2) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_modify_batch, 0, 3, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, modifications_info, IS_ARRAY, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#define arginfo_ldap_mod_add arginfo_ldap_add + +#define arginfo_ldap_mod_add_ext arginfo_ldap_add_ext + +#define arginfo_ldap_mod_replace arginfo_ldap_add + +#define arginfo_ldap_modify arginfo_ldap_add + +#define arginfo_ldap_mod_replace_ext arginfo_ldap_add_ext + +#define arginfo_ldap_mod_del arginfo_ldap_add + +#define arginfo_ldap_mod_del_ext arginfo_ldap_add_ext + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_errno, 0, 1, IS_LONG, 0) + ZEND_ARG_INFO(0, link) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_error, 0, 1, IS_STRING, 0) + ZEND_ARG_INFO(0, link) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_err2str, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, errno, IS_LONG, 0) +ZEND_END_ARG_INFO() + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_compare, 0, 4, MAY_BE_BOOL|MAY_BE_LONG) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, attribute, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() + +#if defined(LDAP_CONTROL_PAGEDRESULTS) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_TYPE_INFO(0, pagesize, IS_LONG, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, iscritical, _IS_BOOL, 0, "false") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, cookie, IS_STRING, 0, "\'\'") +ZEND_END_ARG_INFO() +#endif + +#if defined(LDAP_CONTROL_PAGEDRESULTS) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_control_paged_result_response, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, result) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, cookie, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, estimated, "null") +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_rename, 0, 5, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, newrdn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, newparent, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, deleteoldrdn, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_rename_ext, 0, 0, 5) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, newrdn, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, newparent, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, deleteoldrdn, _IS_BOOL, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 0, "[]") +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_get_option, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, retval, "null") +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_option, 0, 3, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) + ZEND_ARG_INFO(0, newval) +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_count_references, 0, 2, IS_LONG, 0) + ZEND_ARG_INFO(0, link_identifier) + ZEND_ARG_INFO(0, result_identifier) +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_first_reference, 0, 0, 2) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, result) +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_next_reference, 0, 0, 2) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, entry) +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_reference, 0, 3, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, entry) + ZEND_ARG_INFO(1, referrals) +ZEND_END_ARG_INFO() +#endif + +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_result, 0, 3, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, result) + ZEND_ARG_INFO(1, errcode) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, matcheddn, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, errmsg, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, referrals, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, serverctrls, "null") +ZEND_END_ARG_INFO() +#endif + +#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_set_rebind_proc, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_TYPE_INFO(0, callback, IS_CALLABLE, 1) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_LDAP_START_TLS_S) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_start_tls, 0, 1, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link_identifier) +ZEND_END_ARG_INFO() +#endif + +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_escape, 0, 1, IS_STRING, 0) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, ignore, IS_STRING, 0, "\'\'") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0") +ZEND_END_ARG_INFO() + +#if defined(STR_TRANSLATION) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_t61_to_8859, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 0) +ZEND_END_ARG_INFO() +#endif + +#if defined(STR_TRANSLATION) +#define arginfo_ldap_8859_to_t61 arginfo_ldap_t61_to_8859 +#endif + +#if defined(HAVE_LDAP_EXTENDED_OPERATION_S) +ZEND_BEGIN_ARG_INFO_EX(arginfo_ldap_exop, 0, 0, 2) + ZEND_ARG_INFO(0, link) + ZEND_ARG_TYPE_INFO(0, reqoid, IS_STRING, 0) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, reqdata, IS_STRING, 1, "null") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, servercontrols, IS_ARRAY, 1, "[]") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, retdata, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, retoid, "null") +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_LDAP_PASSWD) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_passwd, 0, 1, MAY_BE_STRING|MAY_BE_BOOL) + ZEND_ARG_INFO(0, link) + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, user, IS_STRING, 0, "\'\'") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, oldpw, IS_STRING, 0, "\'\'") + ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, newpw, IS_STRING, 0, "\'\'") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, serverctrls, "null") +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_LDAP_WHOAMI_S) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_whoami, 0, 1, MAY_BE_STRING|MAY_BE_BOOL) + ZEND_ARG_INFO(0, link) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_LDAP_REFRESH_S) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ldap_exop_refresh, 0, 3, MAY_BE_LONG|MAY_BE_FALSE) + ZEND_ARG_INFO(0, link) + ZEND_ARG_TYPE_INFO(0, dn, IS_STRING, 0) + ZEND_ARG_INFO(0, ttl) +ZEND_END_ARG_INFO() +#endif + +#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ldap_parse_exop, 0, 2, _IS_BOOL, 0) + ZEND_ARG_INFO(0, link) + ZEND_ARG_INFO(0, result) + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, retdata, "null") + ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, retoid, "null") +ZEND_END_ARG_INFO() +#endif + + +#if defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_connect); +#endif +#if !(defined(HAVE_ORALDAP)) +ZEND_FUNCTION(ldap_connect); +#endif +ZEND_FUNCTION(ldap_unbind); +ZEND_FUNCTION(ldap_bind); +ZEND_FUNCTION(ldap_bind_ext); +#if defined(HAVE_LDAP_SASL) +ZEND_FUNCTION(ldap_sasl_bind); +#endif +ZEND_FUNCTION(ldap_read); +ZEND_FUNCTION(ldap_list); +ZEND_FUNCTION(ldap_search); +ZEND_FUNCTION(ldap_free_result); +ZEND_FUNCTION(ldap_count_entries); +ZEND_FUNCTION(ldap_first_entry); +ZEND_FUNCTION(ldap_next_entry); +ZEND_FUNCTION(ldap_get_entries); +ZEND_FUNCTION(ldap_first_attribute); +ZEND_FUNCTION(ldap_next_attribute); +ZEND_FUNCTION(ldap_get_attributes); +ZEND_FUNCTION(ldap_get_values_len); +ZEND_FUNCTION(ldap_get_dn); +ZEND_FUNCTION(ldap_explode_dn); +ZEND_FUNCTION(ldap_dn2ufn); +ZEND_FUNCTION(ldap_add); +ZEND_FUNCTION(ldap_add_ext); +ZEND_FUNCTION(ldap_delete); +ZEND_FUNCTION(ldap_delete_ext); +ZEND_FUNCTION(ldap_modify_batch); +ZEND_FUNCTION(ldap_mod_add); +ZEND_FUNCTION(ldap_mod_add_ext); +ZEND_FUNCTION(ldap_mod_replace); +ZEND_FUNCTION(ldap_mod_replace_ext); +ZEND_FUNCTION(ldap_mod_del); +ZEND_FUNCTION(ldap_mod_del_ext); +ZEND_FUNCTION(ldap_errno); +ZEND_FUNCTION(ldap_error); +ZEND_FUNCTION(ldap_err2str); +ZEND_FUNCTION(ldap_compare); +#if defined(LDAP_CONTROL_PAGEDRESULTS) +ZEND_FUNCTION(ldap_control_paged_result); +#endif +#if defined(LDAP_CONTROL_PAGEDRESULTS) +ZEND_FUNCTION(ldap_control_paged_result_response); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_rename); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_rename_ext); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_get_option); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_set_option); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_count_references); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_first_reference); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) +ZEND_FUNCTION(ldap_next_reference); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE) +ZEND_FUNCTION(ldap_parse_reference); +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT) +ZEND_FUNCTION(ldap_parse_result); +#endif +#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) +ZEND_FUNCTION(ldap_set_rebind_proc); +#endif +#if defined(HAVE_LDAP_START_TLS_S) +ZEND_FUNCTION(ldap_start_tls); +#endif +ZEND_FUNCTION(ldap_escape); +#if defined(STR_TRANSLATION) +ZEND_FUNCTION(ldap_t61_to_8859); +#endif +#if defined(STR_TRANSLATION) +ZEND_FUNCTION(ldap_8859_to_t61); +#endif +#if defined(HAVE_LDAP_EXTENDED_OPERATION_S) +ZEND_FUNCTION(ldap_exop); +#endif +#if defined(HAVE_LDAP_PASSWD) +ZEND_FUNCTION(ldap_exop_passwd); +#endif +#if defined(HAVE_LDAP_WHOAMI_S) +ZEND_FUNCTION(ldap_exop_whoami); +#endif +#if defined(HAVE_LDAP_REFRESH_S) +ZEND_FUNCTION(ldap_exop_refresh); +#endif +#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT) +ZEND_FUNCTION(ldap_parse_exop); +#endif + + +static const zend_function_entry ext_functions[] = { +#if defined(HAVE_ORALDAP) + ZEND_FE(ldap_connect, arginfo_ldap_connect) +#endif +#if !(defined(HAVE_ORALDAP)) + ZEND_FE(ldap_connect, arginfo_ldap_connect) +#endif + ZEND_FE(ldap_unbind, arginfo_ldap_unbind) + ZEND_FALIAS(ldap_close, ldap_unbind, arginfo_ldap_close) + ZEND_FE(ldap_bind, arginfo_ldap_bind) + ZEND_FE(ldap_bind_ext, arginfo_ldap_bind_ext) +#if defined(HAVE_LDAP_SASL) + ZEND_FE(ldap_sasl_bind, arginfo_ldap_sasl_bind) +#endif + ZEND_FE(ldap_read, arginfo_ldap_read) + ZEND_FE(ldap_list, arginfo_ldap_list) + ZEND_FE(ldap_search, arginfo_ldap_search) + ZEND_FE(ldap_free_result, arginfo_ldap_free_result) + ZEND_FE(ldap_count_entries, arginfo_ldap_count_entries) + ZEND_FE(ldap_first_entry, arginfo_ldap_first_entry) + ZEND_FE(ldap_next_entry, arginfo_ldap_next_entry) + ZEND_FE(ldap_get_entries, arginfo_ldap_get_entries) + ZEND_FE(ldap_first_attribute, arginfo_ldap_first_attribute) + ZEND_FE(ldap_next_attribute, arginfo_ldap_next_attribute) + ZEND_FE(ldap_get_attributes, arginfo_ldap_get_attributes) + ZEND_FE(ldap_get_values_len, arginfo_ldap_get_values_len) + ZEND_FALIAS(ldap_get_values, ldap_get_values_len, arginfo_ldap_get_values) + ZEND_FE(ldap_get_dn, arginfo_ldap_get_dn) + ZEND_FE(ldap_explode_dn, arginfo_ldap_explode_dn) + ZEND_FE(ldap_dn2ufn, arginfo_ldap_dn2ufn) + ZEND_FE(ldap_add, arginfo_ldap_add) + ZEND_FE(ldap_add_ext, arginfo_ldap_add_ext) + ZEND_FE(ldap_delete, arginfo_ldap_delete) + ZEND_FE(ldap_delete_ext, arginfo_ldap_delete_ext) + ZEND_FE(ldap_modify_batch, arginfo_ldap_modify_batch) + ZEND_FE(ldap_mod_add, arginfo_ldap_mod_add) + ZEND_FE(ldap_mod_add_ext, arginfo_ldap_mod_add_ext) + ZEND_FE(ldap_mod_replace, arginfo_ldap_mod_replace) + ZEND_FALIAS(ldap_modify, ldap_mod_replace, arginfo_ldap_modify) + ZEND_FE(ldap_mod_replace_ext, arginfo_ldap_mod_replace_ext) + ZEND_FE(ldap_mod_del, arginfo_ldap_mod_del) + ZEND_FE(ldap_mod_del_ext, arginfo_ldap_mod_del_ext) + ZEND_FE(ldap_errno, arginfo_ldap_errno) + ZEND_FE(ldap_error, arginfo_ldap_error) + ZEND_FE(ldap_err2str, arginfo_ldap_err2str) + ZEND_FE(ldap_compare, arginfo_ldap_compare) +#if defined(LDAP_CONTROL_PAGEDRESULTS) + ZEND_DEP_FE(ldap_control_paged_result, arginfo_ldap_control_paged_result) +#endif +#if defined(LDAP_CONTROL_PAGEDRESULTS) + ZEND_DEP_FE(ldap_control_paged_result_response, arginfo_ldap_control_paged_result_response) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_rename, arginfo_ldap_rename) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_rename_ext, arginfo_ldap_rename_ext) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_get_option, arginfo_ldap_get_option) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_set_option, arginfo_ldap_set_option) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_count_references, arginfo_ldap_count_references) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_first_reference, arginfo_ldap_first_reference) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) + ZEND_FE(ldap_next_reference, arginfo_ldap_next_reference) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_REFERENCE) + ZEND_FE(ldap_parse_reference, arginfo_ldap_parse_reference) +#endif +#if (LDAP_API_VERSION > 2000) || defined(HAVE_ORALDAP) && defined(HAVE_LDAP_PARSE_RESULT) + ZEND_FE(ldap_parse_result, arginfo_ldap_parse_result) +#endif +#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC) + ZEND_FE(ldap_set_rebind_proc, arginfo_ldap_set_rebind_proc) +#endif +#if defined(HAVE_LDAP_START_TLS_S) + ZEND_FE(ldap_start_tls, arginfo_ldap_start_tls) +#endif + ZEND_FE(ldap_escape, arginfo_ldap_escape) +#if defined(STR_TRANSLATION) + ZEND_FE(ldap_t61_to_8859, arginfo_ldap_t61_to_8859) +#endif +#if defined(STR_TRANSLATION) + ZEND_FE(ldap_8859_to_t61, arginfo_ldap_8859_to_t61) +#endif +#if defined(HAVE_LDAP_EXTENDED_OPERATION_S) + ZEND_FE(ldap_exop, arginfo_ldap_exop) +#endif +#if defined(HAVE_LDAP_PASSWD) + ZEND_FE(ldap_exop_passwd, arginfo_ldap_exop_passwd) +#endif +#if defined(HAVE_LDAP_WHOAMI_S) + ZEND_FE(ldap_exop_whoami, arginfo_ldap_exop_whoami) +#endif +#if defined(HAVE_LDAP_REFRESH_S) + ZEND_FE(ldap_exop_refresh, arginfo_ldap_exop_refresh) +#endif +#if defined(HAVE_LDAP_PARSE_EXTENDED_RESULT) + ZEND_FE(ldap_parse_exop, arginfo_ldap_parse_exop) +#endif + ZEND_FE_END +}; diff --git a/ext/ldap/php_ldap.h b/ext/ldap/php_ldap.h index f777fe9a5f..fcda55e92f 100644 --- a/ext/ldap/php_ldap.h +++ b/ext/ldap/php_ldap.h @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | diff --git a/ext/ldap/tests/bug48441.phpt b/ext/ldap/tests/bug48441.phpt index 4f212e7402..c4b224c7a7 100644 --- a/ext/ldap/tests/bug48441.phpt +++ b/ext/ldap/tests/bug48441.phpt @@ -18,19 +18,18 @@ $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn')), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn')), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn')), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn')), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -166,4 +165,3 @@ array(4) { string(%d) "cn=userC,cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/bug48696.phpt b/ext/ldap/tests/bug48696.phpt deleted file mode 100644 index 8d25b67236..0000000000 --- a/ext/ldap/tests/bug48696.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Bug #48696 (ldap_read() segfaults with invalid parameters) ---SKIPIF-- -<?php -require_once('skipif.inc'); -require_once('skipifbindfailure.inc'); -?> ---FILE-- -<?php - -ldap_read(1,1,1); - -?> ---EXPECTF-- -Warning: ldap_read(): supplied argument is not a valid ldap link resource in %s on line %d diff --git a/ext/ldap/tests/bug73933.phpt b/ext/ldap/tests/bug73933.phpt index ac934a8dd8..8e50a750e2 100644 --- a/ext/ldap/tests/bug73933.phpt +++ b/ext/ldap/tests/bug73933.phpt @@ -10,15 +10,15 @@ require_once('skipif.inc'); $ldap = ldap_connect('127.0.0.1', 3333); ldap_mod_replace($ldap, null, array( - 'lockoutTime' => array(0), + 'lockoutTime' => array(0), )); ldap_modify_batch($ldap, null, array( [ - "attrib" => "mail", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => [ - "test@example.com", - "test-2@example.com", ]])); + "attrib" => "mail", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => [ + "test@example.com", + "test-2@example.com", ]])); ldap_close($ldap); diff --git a/ext/ldap/tests/bug77958.phpt b/ext/ldap/tests/bug77958.phpt index 7cac768b1a..b370b40eda 100644 --- a/ext/ldap/tests/bug77958.phpt +++ b/ext/ldap/tests/bug77958.phpt @@ -13,26 +13,25 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $mods = array( - array( - "attrib" => "telephoneNumber", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array( - 123456 - ) - ), - array( - "attrib" => "description", - "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL - ) + array( + "attrib" => "telephoneNumber", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array( + 123456 + ) + ), + array( + "attrib" => "description", + "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL + ) ); var_dump( - ldap_modify_batch($link, "cn=userA,$base", $mods), - $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")), - ldap_get_values($link, $entry, "telephoneNumber") + ldap_modify_batch($link, "cn=userA,$base", $mods), + $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")), + ldap_get_values($link, $entry, "telephoneNumber") ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -52,4 +51,3 @@ array(3) { ["count"]=> int(2) } -===DONE=== diff --git a/ext/ldap/tests/connect.inc b/ext/ldap/tests/connect.inc index 101895c33d..e3a9d1c777 100644 --- a/ext/ldap/tests/connect.inc +++ b/ext/ldap/tests/connect.inc @@ -16,74 +16,74 @@ $protocol_version = getenv("LDAP_TEST_OPT_PROTOCOL_VERSION") ?: 3; $skip_on_bind_failure = getenv("LDAP_TEST_SKIP_BIND_FAILURE") ?: true; function ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version) { - $link = ldap_connect($host, $port); - ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - ldap_bind($link, $user, $passwd); - return $link; + $link = ldap_connect($host, $port); + ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + ldap_bind($link, $user, $passwd); + return $link; } function test_bind($host, $port, $user, $passwd, $protocol_version) { - $link = ldap_connect($host, $port); - ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - return ldap_bind($link, $user, $passwd); + $link = ldap_connect($host, $port); + ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + return ldap_bind($link, $user, $passwd); } function insert_dummy_data($link, $base) { - // Create root if not there - $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass')); - if (ldap_count_entries($link, $testBase) < 1) { - ldap_add( - $link, "$base", array( - "objectClass" => array( - "top", - "organization", - "dcObject" - ), - "o" => "php ldap tests" - ) - ); - } - ldap_add($link, "o=test,$base", array( - "objectClass" => array( + // Create root if not there + $testBase = ldap_read($link, $base, '(objectClass=*)', array('objectClass')); + if (ldap_count_entries($link, $testBase) < 1) { + ldap_add( + $link, "$base", array( + "objectClass" => array( + "top", + "organization", + "dcObject" + ), + "o" => "php ldap tests" + ) + ); + } + ldap_add($link, "o=test,$base", array( + "objectClass" => array( "top", "organization"), - "o" => "test", - )); - ldap_add($link, "cn=userA,$base", array( - "objectclass" => "person", - "cn" => "userA", - "sn" => "testSN1", - "userPassword" => "oops", - "telephoneNumber" => "xx-xx-xx-xx-xx", - "description" => "user A", - )); - ldap_add($link, "cn=userB,$base", array( - "objectclass" => "person", - "cn" => "userB", - "sn" => "testSN2", - "userPassword" => "oopsIDitItAgain", - "description" => "user B", - )); - ldap_add($link, "cn=userC,cn=userB,$base", array( - "objectclass" => "person", - "cn" => "userC", - "sn" => "testSN3", - "userPassword" => "0r1g1na1 passw0rd", - )); - ldap_add($link, "o=test2,$base", array( - "objectClass" => array( + "o" => "test", + )); + ldap_add($link, "cn=userA,$base", array( + "objectclass" => "person", + "cn" => "userA", + "sn" => "testSN1", + "userPassword" => "oops", + "telephoneNumber" => "xx-xx-xx-xx-xx", + "description" => "user A", + )); + ldap_add($link, "cn=userB,$base", array( + "objectclass" => "person", + "cn" => "userB", + "sn" => "testSN2", + "userPassword" => "oopsIDitItAgain", + "description" => "user B", + )); + ldap_add($link, "cn=userC,cn=userB,$base", array( + "objectclass" => "person", + "cn" => "userC", + "sn" => "testSN3", + "userPassword" => "0r1g1na1 passw0rd", + )); + ldap_add($link, "o=test2,$base", array( + "objectClass" => array( "top", "organization"), - "o" => "test2", - "l" => array("here", "there", "Antarctica"), - )); + "o" => "test2", + "l" => array("here", "there", "Antarctica"), + )); } function remove_dummy_data($link, $base) { - ldap_delete($link, "cn=userC,cn=userB,$base"); - ldap_delete($link, "cn=userA,$base"); - ldap_delete($link, "cn=userB,$base"); - ldap_delete($link, "o=test,$base"); - ldap_delete($link, "o=test2,$base"); + ldap_delete($link, "cn=userC,cn=userB,$base"); + ldap_delete($link, "cn=userA,$base"); + ldap_delete($link, "cn=userB,$base"); + ldap_delete($link, "o=test,$base"); + ldap_delete($link, "o=test2,$base"); } ?> diff --git a/ext/ldap/tests/ldap_add_basic.phpt b/ext/ldap/tests/ldap_add_basic.phpt index 46fd6578db..b247901d73 100644 --- a/ext/ldap/tests/ldap_add_basic.phpt +++ b/ext/ldap/tests/ldap_add_basic.phpt @@ -13,21 +13,20 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump( - ldap_add($link, "dc=my-domain,$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", - )), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=my-domain)") - ) + ldap_add($link, "dc=my-domain,$base", array( + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", + )), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=my-domain)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -80,4 +79,3 @@ array(2) { string(%d) "dc=my-domain,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_add_error.phpt b/ext/ldap/tests/ldap_add_error.phpt index 533496a4b2..61b4d2808d 100644 --- a/ext/ldap/tests/ldap_add_error.phpt +++ b/ext/ldap/tests/ldap_add_error.phpt @@ -12,28 +12,20 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -// Too few parameters -var_dump(ldap_add()); -var_dump(ldap_add($link)); -var_dump(ldap_add($link, "$base")); - -// Too many parameters -var_dump(ldap_add($link, "$base", array(), [], "Additional data")); - var_dump(ldap_add($link, "$base", array())); // Invalid DN var_dump( - ldap_add($link, "weirdAttribute=val", array( - "weirdAttribute" => "val", - )), - ldap_error($link), - ldap_errno($link) + ldap_add($link, "weirdAttribute=val", array( + "weirdAttribute" => "val", + )), + ldap_error($link), + ldap_errno($link) ); // Duplicate entry for ($i = 0; $i < 2; $i++) - var_dump( + var_dump( ldap_add($link, "dc=my-domain,$base", array( "objectClass" => array( "top", @@ -42,52 +34,51 @@ for ($i = 0; $i < 2; $i++) "dc" => "my-domain", "o" => "my-domain", )) - ); + ); var_dump(ldap_error($link), ldap_errno($link)); // Wrong array indexes var_dump( - ldap_add($link, "dc=my-domain2,dc=com", array( - "objectClass" => array( - 0 => "top", - 2 => "dcObject", - 5 => "organization"), - "dc" => "my-domain", - "o" => "my-domain", - )) - /* Is this correct behaviour to still have "Already exists" as error/errno? - , - ldap_error($link), - ldap_errno($link) - */ + ldap_add($link, "dc=my-domain2,dc=com", array( + "objectClass" => array( + 0 => "top", + 2 => "dcObject", + 5 => "organization"), + "dc" => "my-domain", + "o" => "my-domain", + )) + /* Is this correct behaviour to still have "Already exists" as error/errno? + , + ldap_error($link), + ldap_errno($link) + */ ); // Invalid attribute var_dump( - ldap_add($link, "$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", - "weirdAttr" => "weirdVal", - )), - ldap_error($link), - ldap_errno($link) + ldap_add($link, "$base", array( + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", + "weirdAttr" => "weirdVal", + )), + ldap_error($link), + ldap_errno($link) ); var_dump( - ldap_add($link, "$base", array(array( "Oops" - ))) - /* Is this correct behaviour to still have "Undefined attribute type" as error/errno? - , - ldap_error($link), - ldap_errno($link) - */ + ldap_add($link, "$base", array(array( "Oops" + ))) + /* Is this correct behaviour to still have "Undefined attribute type" as error/errno? + , + ldap_error($link), + ldap_errno($link) + */ ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -97,18 +88,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_add() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_add() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_add() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_add() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: ldap_add(): Add: Protocol error in %s on line %d bool(false) @@ -133,4 +112,3 @@ int(17) Warning: ldap_add(): Unknown attribute in the data in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_add_ext.phpt b/ext/ldap/tests/ldap_add_ext.phpt index 12916d98c3..fbcaff523b 100644 --- a/ext/ldap/tests/ldap_add_ext.phpt +++ b/ext/ldap/tests/ldap_add_ext.phpt @@ -16,23 +16,22 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump( - $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array( - "objectClass" => array( - "top", - "organization"), - "o" => "test_ldap_add_ext", - ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls[LDAP_CONTROL_POST_READ], - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=test_ldap_add_ext)") - ) + $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array( + "objectClass" => array( + "top", + "organization"), + "o" => "test_ldap_add_ext", + ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_POST_READ], + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=test_ldap_add_ext)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -91,4 +90,3 @@ array(2) { string(%d) "o=test_ldap_add_ext,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_bind_basic.phpt b/ext/ldap/tests/ldap_bind_basic.phpt index d88dd1083b..35948d0dc2 100644 --- a/ext/ldap/tests/ldap_bind_basic.phpt +++ b/ext/ldap/tests/ldap_bind_basic.phpt @@ -14,7 +14,5 @@ $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(ldap_bind($link)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_bind_error.phpt b/ext/ldap/tests/ldap_bind_error.phpt index a569ce6922..3970bbdf85 100644 --- a/ext/ldap/tests/ldap_bind_error.phpt +++ b/ext/ldap/tests/ldap_bind_error.phpt @@ -13,23 +13,15 @@ require "connect.inc"; $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); -// Invalid parameter count -var_dump(ldap_bind($link, $user, $passwd, null)); - // Invalid password var_dump(ldap_bind($link, $user, "ThisIsNotCorrect$passwd")); // Invalid DN syntax var_dump(ldap_bind($link, "unexistingProperty=weirdValue,$user", $passwd)); ?> -===DONE=== --EXPECTF-- -Warning: ldap_bind() expects at most 3 parameters, 4 given in %s on line %d -bool(false) - Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d bool(false) Warning: ldap_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_bind_ext.phpt b/ext/ldap/tests/ldap_bind_ext.phpt index 3dd5903d80..685b0588ce 100644 --- a/ext/ldap/tests/ldap_bind_ext.phpt +++ b/ext/ldap/tests/ldap_bind_ext.phpt @@ -17,33 +17,32 @@ $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump( - $result = ldap_bind_ext($link, $user, $passwd), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls + $result = ldap_bind_ext($link, $user, $passwd), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls ); /* Failures */ var_dump( - $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls + $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls ); ?> -===DONE=== --EXPECTF-- resource(%d) of type (ldap result) bool(true) @@ -69,4 +68,3 @@ int(34) string(10) "invalid DN" array(0) { } -===DONE=== diff --git a/ext/ldap/tests/ldap_bind_variation.phpt b/ext/ldap/tests/ldap_bind_variation.phpt index 4aed3180ee..6fa4c202f9 100644 --- a/ext/ldap/tests/ldap_bind_variation.phpt +++ b/ext/ldap/tests/ldap_bind_variation.phpt @@ -14,7 +14,5 @@ $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(ldap_bind($link, $user, $passwd)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_compare_basic.phpt b/ext/ldap/tests/ldap_compare_basic.phpt index a8bb37f004..32f6ccf78f 100644 --- a/ext/ldap/tests/ldap_compare_basic.phpt +++ b/ext/ldap/tests/ldap_compare_basic.phpt @@ -13,11 +13,10 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_compare($link, "cn=userA,$base", "sn", "testSN1"), - ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy") + ldap_compare($link, "cn=userA,$base", "sn", "testSN1"), + ldap_compare($link, "cn=userA,$base", "telephoneNumber", "yy-yy-yy-yy-yy") ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -28,4 +27,3 @@ remove_dummy_data($link, $base); --EXPECT-- bool(true) bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_compare_error.phpt b/ext/ldap/tests/ldap_compare_error.phpt index 120dfab059..1b1231b6f9 100644 --- a/ext/ldap/tests/ldap_compare_error.phpt +++ b/ext/ldap/tests/ldap_compare_error.phpt @@ -13,21 +13,12 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); -// Too few parameters -var_dump(ldap_compare($link)); -var_dump(ldap_compare($link, $link)); -var_dump(ldap_compare($link, $link, $link)); - -// Too many parameters -var_dump(ldap_compare($link, $link, $link, $link, [], "Additional data")); - var_dump( - ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"), - ldap_error($link), - ldap_errno($link) + ldap_compare($link, "cn=userNotAvailable,$base", "sn", "testSN1"), + ldap_error($link), + ldap_errno($link) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -36,20 +27,7 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -Warning: ldap_compare() expects at least 4 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_compare() expects at least 4 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_compare() expects at least 4 parameters, 3 given in %s on line %d -NULL - -Warning: ldap_compare() expects at most 5 parameters, 6 given in %s on line %d -NULL - Warning: ldap_compare(): Compare: No such object in %s on line %d int(-1) string(14) "No such object" int(32) -===DONE=== diff --git a/ext/ldap/tests/ldap_connect_basic.phpt b/ext/ldap/tests/ldap_connect_basic.phpt index 26133a6b2e..0d03c99d59 100644 --- a/ext/ldap/tests/ldap_connect_basic.phpt +++ b/ext/ldap/tests/ldap_connect_basic.phpt @@ -12,7 +12,5 @@ require "connect.inc"; $link = ldap_connect($host, $port); var_dump($link); ?> -===DONE=== --EXPECTF-- resource(%d) of type (ldap link) -===DONE=== diff --git a/ext/ldap/tests/ldap_connect_error.phpt b/ext/ldap/tests/ldap_connect_error.phpt index b93375c39e..b8adcf1ded 100644 --- a/ext/ldap/tests/ldap_connect_error.phpt +++ b/ext/ldap/tests/ldap_connect_error.phpt @@ -12,20 +12,14 @@ ldap.max_links=1 require "connect.inc"; // too many arguments -var_dump(ldap_connect(null, null, null)); var_dump(ldap_connect("ldap://$host:$port/$base")); $links = array(); $links[0] = ldap_connect($host, $port); $links[1] = ldap_connect($host, $port); ?> -===DONE=== --EXPECTF-- -Warning: ldap_connect() expects at most 2 parameters, 3 given in %s on line %d -bool(false) - Warning: ldap_connect(): Could not create session handle: %s in %s on line %d bool(false) Warning: ldap_connect(): Too many open links (1) in %s on line %d -===DONE=== diff --git a/ext/ldap/tests/ldap_connect_ldap_conf.phpt b/ext/ldap/tests/ldap_connect_ldap_conf.phpt index 86b17b5613..3c3c906f36 100644 --- a/ext/ldap/tests/ldap_connect_ldap_conf.phpt +++ b/ext/ldap/tests/ldap_connect_ldap_conf.phpt @@ -20,7 +20,5 @@ ldap_get_option($link, LDAP_OPT_HOST_NAME, $host); var_dump($host); unlink($conf); ?> -===DONE=== --EXPECT-- string(16) "example.com:3141" -===DONE=== diff --git a/ext/ldap/tests/ldap_connect_variation.phpt b/ext/ldap/tests/ldap_connect_variation.phpt index 09b07e7786..1405e0706f 100644 --- a/ext/ldap/tests/ldap_connect_variation.phpt +++ b/ext/ldap/tests/ldap_connect_variation.phpt @@ -29,11 +29,9 @@ var_dump($link); $link = ldap_connect("nonexistent" . $host); var_dump($link); ?> -===DONE=== --EXPECTF-- resource(%d) of type (ldap link) resource(%d) of type (ldap link) resource(%d) of type (ldap link) resource(%d) of type (ldap link) resource(%d) of type (ldap link) -===DONE=== diff --git a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt index 76084cfb4b..75d147e0be 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation1.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation1.phpt @@ -17,12 +17,11 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - ldap_control_paged_result($link, 1), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result) + ldap_control_paged_result($link, 1), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -54,4 +53,3 @@ array(2) { string(%d) "cn=userA,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt index 6b7eb35537..b0b6e62aff 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation2.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation2.phpt @@ -17,12 +17,11 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - ldap_control_paged_result($link, 2), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result) + ldap_control_paged_result($link, 2), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -70,4 +69,3 @@ array(3) { string(%d) "cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt index 0099b1f9a1..de904f051f 100644 --- a/ext/ldap/tests/ldap_control_paged_results_variation3.phpt +++ b/ext/ldap/tests/ldap_control_paged_results_variation3.phpt @@ -18,16 +18,15 @@ $dn = "$base"; $filter = "(cn=user*)"; $cookie = ''; var_dump( - ldap_control_paged_result($link, 2, true, $cookie), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result), - ldap_control_paged_result_response($link, $result, $cookie), - ldap_control_paged_result($link, 20, true, $cookie), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_get_entries($link, $result) + ldap_control_paged_result($link, 2, true, $cookie), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result), + ldap_control_paged_result_response($link, $result, $cookie), + ldap_control_paged_result($link, 20, true, $cookie), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -102,4 +101,3 @@ array(2) { string(%d) "cn=userC,cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_controls.phpt b/ext/ldap/tests/ldap_controls.phpt index 8a9c8f9f22..e6e0ab6164 100644 --- a/ext/ldap/tests/ldap_controls.phpt +++ b/ext/ldap/tests/ldap_controls.phpt @@ -19,38 +19,37 @@ insert_dummy_data($link, $base); /* Test assertion control */ var_dump( - $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]), - ldap_get_entries($link, $result), - $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]), - ldap_modify($link, "o=test,$base", ['description' => 'desc'], - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), - $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), - ldap_get_entries($link, $result), - ldap_modify($link, "o=test,$base", ['description' => 'desc2'], - [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), - $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), - ldap_get_entries($link, $result), - ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), - ldap_errno($link), - ldap_error($link), - ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), - ldap_compare($link, "o=test,$base", "o", "test"), - ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), - ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]]) + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organization)']]]), + ldap_get_entries($link, $result), + $result = ldap_search($link, "o=test,$base", "objectClass=*", array('o'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(objectClass=organizationalUnit)']]]), + ldap_modify($link, "o=test,$base", ['description' => 'desc'], + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), + $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), + ldap_get_entries($link, $result), + ldap_modify($link, "o=test,$base", ['description' => 'desc2'], + [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(!(description=*))']]]), + $result = ldap_read($link, "o=test,$base", "objectClass=*", array('description')), + ldap_get_entries($link, $result), + ldap_delete($link, "o=test,$base", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_errno($link), + ldap_error($link), + ldap_rename($link, "o=test,$base", "o=test2", "", TRUE, [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_compare($link, "o=test,$base", "o", "test"), + ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc2)']]]), + ldap_compare($link, "o=test,$base", "o", "test", [['oid' => LDAP_CONTROL_ASSERT, 'iscritical' => TRUE, 'value' => ['filter' => '(description=desc)']]]) ); /* Test valuesreturnfilter control */ var_dump( - $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]), - ldap_get_entries($link, $result)[0]['l'], - $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]), - ldap_get_entries($link, $result)[0]['l'] + $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"]), + ldap_get_entries($link, $result)[0]['l'], + $result = ldap_read($link, "o=test2,$base", "objectClass=*", ["l"], 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_VALUESRETURNFILTER, 'iscritical' => TRUE, 'value' => ['filter' => '(l=*here)']]]), + ldap_get_entries($link, $result)[0]['l'] ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -159,4 +158,3 @@ array(3) { [1]=> string(5) "there" } -===DONE=== diff --git a/ext/ldap/tests/ldap_count_entries_basic.phpt b/ext/ldap/tests/ldap_count_entries_basic.phpt index 7eef960614..01847f1b03 100644 --- a/ext/ldap/tests/ldap_count_entries_basic.phpt +++ b/ext/ldap/tests/ldap_count_entries_basic.phpt @@ -15,7 +15,6 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=person)"); var_dump(ldap_count_entries($link, $result)); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -25,4 +24,3 @@ remove_dummy_data($link, $base); ?> --EXPECT-- int(3) -===DONE=== diff --git a/ext/ldap/tests/ldap_count_entries_error.phpt b/ext/ldap/tests/ldap_count_entries_error.phpt deleted file mode 100644 index 552625a7eb..0000000000 --- a/ext/ldap/tests/ldap_count_entries_error.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ldap_count_entries() - Testing counting LDAP entries that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_count_entries($link)); -var_dump(ldap_count_entries($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_count_entries() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_count_entries(): supplied resource is not a valid ldap result resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_count_references_basic.phpt b/ext/ldap/tests/ldap_count_references_basic.phpt new file mode 100644 index 0000000000..52ed8c0253 --- /dev/null +++ b/ext/ldap/tests/ldap_count_references_basic.phpt @@ -0,0 +1,36 @@ +--TEST-- +ldap_count_references() - Basic ldap_count_references test +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +<?php require_once('skipifbindfailure.inc'); ?> +--FILE-- +<?php +require "connect.inc"; +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +insert_dummy_data($link, $base); +ldap_add($link, "cn=userref,$base", array( + "objectClass" => array("extensibleObject", "referral"), + "cn" => "userref", + "ref" => "cn=userA,$base", +)); +ldap_add($link, "cn=userref2,$base", array( + "objectClass" => array("extensibleObject", "referral"), + "cn" => "userref2", + "ref" => "cn=userB,$base", +)); +ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); +$result = ldap_search($link, "$base", "(cn=*)"); +var_dump(ldap_count_references($link, $result)); +?> +--CLEAN-- +<?php +include "connect.inc"; + +$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); +// Referral can only be removed with Manage DSA IT Control +ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]); +ldap_delete($link, "cn=userref2,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]); +remove_dummy_data($link, $base); +?> +--EXPECTF-- +int(2) diff --git a/ext/ldap/tests/ldap_delete_basic.phpt b/ext/ldap/tests/ldap_delete_basic.phpt index 84499f2a06..046b141407 100644 --- a/ext/ldap/tests/ldap_delete_basic.phpt +++ b/ext/ldap/tests/ldap_delete_basic.phpt @@ -12,20 +12,19 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_add($link, "dc=my-domain,$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - ldap_delete($link, "dc=my-domain,$base"), - @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") + ldap_delete($link, "dc=my-domain,$base"), + @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -37,4 +36,3 @@ ldap_delete($link, "dc=my-domain,$base"); --EXPECT-- bool(true) bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_delete_error.phpt b/ext/ldap/tests/ldap_delete_error.phpt index a34d7b39fe..e924c3b59a 100644 --- a/ext/ldap/tests/ldap_delete_error.phpt +++ b/ext/ldap/tests/ldap_delete_error.phpt @@ -12,28 +12,20 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -// Too few parameters -var_dump(ldap_delete()); -var_dump(ldap_delete($link)); - -// Too many parameters -var_dump(ldap_delete($link, "$base", [], "Additional data")); - // Invalid DN var_dump( - ldap_delete($link, "weirdAttribute=val"), - ldap_error($link), - ldap_errno($link) + ldap_delete($link, "weirdAttribute=val"), + ldap_error($link), + ldap_errno($link) ); // Deleting unexisting data var_dump( - ldap_delete($link, "dc=my-domain,$base"), - ldap_error($link), - ldap_errno($link) + ldap_delete($link, "dc=my-domain,$base"), + ldap_error($link), + ldap_errno($link) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -41,15 +33,6 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ?> --EXPECTF-- -Warning: ldap_delete() expects at least 2 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_delete() expects at least 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_delete() expects at most 3 parameters, 4 given in %s on line %d -NULL - Warning: ldap_delete(): Delete: Invalid DN syntax in %s on line %d bool(false) string(17) "Invalid DN syntax" @@ -59,4 +42,3 @@ Warning: ldap_delete(): Delete: No such object in %s on line %d bool(false) string(14) "No such object" int(32) -===DONE=== diff --git a/ext/ldap/tests/ldap_delete_ext.phpt b/ext/ldap/tests/ldap_delete_ext.phpt index c4d0264088..bcdc15ba51 100644 --- a/ext/ldap/tests/ldap_delete_ext.phpt +++ b/ext/ldap/tests/ldap_delete_ext.phpt @@ -15,26 +15,25 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_add($link, "dc=my-domain,$base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - $result = ldap_delete_ext($link, "dc=my-domain,$base", - [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls[LDAP_CONTROL_PRE_READ], - @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") + $result = ldap_delete_ext($link, "dc=my-domain,$base", + [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_PRE_READ], + @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)") ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -68,4 +67,3 @@ array(2) { } } bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_dn2ufn.phpt b/ext/ldap/tests/ldap_dn2ufn.phpt index 8082e97809..54c90658cf 100644 --- a/ext/ldap/tests/ldap_dn2ufn.phpt +++ b/ext/ldap/tests/ldap_dn2ufn.phpt @@ -14,20 +14,15 @@ var_dump(ldap_dn2ufn("cn=bob,ou=users,dc=example,dc=com")); /* Convert DN with < > characters */ var_dump(ldap_dn2ufn("cn=<bob>,dc=example,dc=com")); -/* Too many parameters */ -ldap_dn2ufn("cn=bob,dc=example,dc=com", 1); - /* Bad DN value */ var_dump(ldap_dn2ufn("bob,dc=example,dc=com")); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- string(16) "bob, example.com" string(23) "bob, users, example.com" bool(false) - -Warning: ldap_dn2ufn() expects exactly 1 parameter, 2 given in %s on line %d bool(false) Done diff --git a/ext/ldap/tests/ldap_err2str_basic.phpt b/ext/ldap/tests/ldap_err2str_basic.phpt index 0ecad03402..fe04d3ca44 100644 --- a/ext/ldap/tests/ldap_err2str_basic.phpt +++ b/ext/ldap/tests/ldap_err2str_basic.phpt @@ -9,7 +9,5 @@ Patrick Allaert <patrickallaert@php.net> <?php var_dump(ldap_err2str(2)); ?> -===DONE=== --EXPECT-- string(14) "Protocol error" -===DONE=== diff --git a/ext/ldap/tests/ldap_err2str_error.phpt b/ext/ldap/tests/ldap_err2str_error.phpt deleted file mode 100644 index 0963ac4101..0000000000 --- a/ext/ldap/tests/ldap_err2str_error.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -ldap_err2str() - Incorrect usage of number to string conversion ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -// Too few args -var_dump(ldap_err2str()); - -// Too many args -var_dump(ldap_err2str(1, "Additional data")); - -var_dump(ldap_err2str("weird")); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_err2str() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: ldap_err2str() expects exactly 1 parameter, 2 given in %s on line %d -NULL - -Warning: ldap_err2str() expects parameter 1 to be int, string given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_errno_basic.phpt b/ext/ldap/tests/ldap_errno_basic.phpt index 58fa9387c0..535bb290ac 100644 --- a/ext/ldap/tests/ldap_errno_basic.phpt +++ b/ext/ldap/tests/ldap_errno_basic.phpt @@ -12,19 +12,17 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); @ldap_add($link, "badDN $base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - ldap_errno($link) + ldap_errno($link) ); ?> -===DONE=== --EXPECT-- int(34) -===DONE=== diff --git a/ext/ldap/tests/ldap_errno_error.phpt b/ext/ldap/tests/ldap_errno_error.phpt deleted file mode 100644 index a05876c88e..0000000000 --- a/ext/ldap/tests/ldap_errno_error.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ldap_errno() - ldap_errno() operation that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -// Too few parameters -var_dump(ldap_errno()); - -// Too many parameters -var_dump(ldap_errno(null, null)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_errno() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: ldap_errno() expects exactly 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_error_basic.phpt b/ext/ldap/tests/ldap_error_basic.phpt index ba42d1d32e..442936c3ae 100644 --- a/ext/ldap/tests/ldap_error_basic.phpt +++ b/ext/ldap/tests/ldap_error_basic.phpt @@ -12,19 +12,17 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); @ldap_add($link, "badDN $base", array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", )); var_dump( - ldap_error($link) + ldap_error($link) ); ?> -===DONE=== --EXPECT-- string(17) "Invalid DN syntax" -===DONE=== diff --git a/ext/ldap/tests/ldap_error_error.phpt b/ext/ldap/tests/ldap_error_error.phpt deleted file mode 100644 index e74eacf008..0000000000 --- a/ext/ldap/tests/ldap_error_error.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ldap_error() - ldap_error() operation that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -// Too few parameters -var_dump(ldap_error()); - -// Too many parameters -var_dump(ldap_error(null, null)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_error() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: ldap_error() expects exactly 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt index f5543c0e4e..abb63e877f 100644 --- a/ext/ldap/tests/ldap_exop.phpt +++ b/ext/ldap/tests/ldap_exop.phpt @@ -14,24 +14,24 @@ insert_dummy_data($link, $base); function build_reqdata_passwd($user, $oldpw, $newpw) { - // This is basic and will only work for small strings - $hex = ''; - if (!empty($user)) { - $hex .= '80'.sprintf("%'.02x", strlen($user)).bin2hex($user); - } - if (!empty($oldpw)) { - $hex .= '81'.sprintf("%'.02x", strlen($oldpw)).bin2hex($oldpw); - } - if (!empty($newpw)) { - $hex .= '82'.sprintf("%'.02x", strlen($newpw)).bin2hex($newpw); - } - return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); + // This is basic and will only work for small strings + $hex = ''; + if (!empty($user)) { + $hex .= '80'.sprintf("%'.02x", strlen($user)).bin2hex($user); + } + if (!empty($oldpw)) { + $hex .= '81'.sprintf("%'.02x", strlen($oldpw)).bin2hex($oldpw); + } + if (!empty($newpw)) { + $hex .= '82'.sprintf("%'.02x", strlen($newpw)).bin2hex($newpw); + } + return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); } function extract_genpw($retdata) { - // Only works for small strings as well - return hex2bin(substr(bin2hex($retdata), 4*2)); + // Only works for small strings as well + return hex2bin(substr(bin2hex($retdata), 4*2)); } $userAPassword = "oops"; @@ -39,23 +39,22 @@ $userAPassword = "oops"; // ldap_exop(resource link, string reqoid [, string reqdata [, array servercontrols [, string &retdata [, string &retoid]]]]) // bool ldap_parse_exop(resource link, resource result [, string &retdata [, string &retoid]]) var_dump( - ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid), - $retdata, - $retoid, - ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata), - $retdata, - $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I), - ldap_parse_exop($link, $r, $retdata2), - $retdata2, - test_bind($host, $port, "cn=userA,$base", $userAPassword, $protocol_version), - $r = ldap_exop($link, LDAP_EXOP_MODIFY_PASSWD, build_reqdata_passwd("cn=userA,$base", $userAPassword, "")), - ldap_parse_exop($link, $r, $retpwdata, $retpwoid), - $genpw = extract_genpw($retpwdata), - $retpwoid, - test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version) + ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, NULL, $retdata, $retoid), + $retdata, + $retoid, + ldap_exop($link, LDAP_EXOP_WHO_AM_I, NULL, [['oid' => LDAP_CONTROL_PROXY_AUTHZ, 'value' => "dn:cn=userA,$base"]], $retdata), + $retdata, + $r = ldap_exop($link, LDAP_EXOP_WHO_AM_I), + ldap_parse_exop($link, $r, $retdata2), + $retdata2, + test_bind($host, $port, "cn=userA,$base", $userAPassword, $protocol_version), + $r = ldap_exop($link, LDAP_EXOP_MODIFY_PASSWD, build_reqdata_passwd("cn=userA,$base", $userAPassword, "")), + ldap_parse_exop($link, $r, $retpwdata, $retpwoid), + $genpw = extract_genpw($retpwdata), + $retpwoid, + test_bind($host, $port, "cn=userA,$base", $genpw, $protocol_version) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -79,4 +78,3 @@ bool(true) string(%d) "%s" string(0) "" bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_exop_passwd.phpt b/ext/ldap/tests/ldap_exop_passwd.phpt index e50b30760c..1b0a1e7397 100644 --- a/ext/ldap/tests/ldap_exop_passwd.phpt +++ b/ext/ldap/tests/ldap_exop_passwd.phpt @@ -24,7 +24,6 @@ var_dump( test_bind($host, $port, "cn=userA,$base", "newPassword", $protocol_version) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -41,4 +40,3 @@ string(%d) "%s" bool(true) bool(true) bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_exop_passwd_error.phpt b/ext/ldap/tests/ldap_exop_passwd_error.phpt index bfb0cbcae2..de21b7af8e 100644 --- a/ext/ldap/tests/ldap_exop_passwd_error.phpt +++ b/ext/ldap/tests/ldap_exop_passwd_error.phpt @@ -18,7 +18,6 @@ var_dump(ldap_error($link)); var_dump(ldap_errno($link)); var_dump(test_bind($host, $port, "cn=userA,$base", "newPassword", $protocol_version)); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -37,4 +36,3 @@ int(53) Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_exop_refresh.phpt b/ext/ldap/tests/ldap_exop_refresh.phpt index 13539d53c1..b90a92bc00 100644 --- a/ext/ldap/tests/ldap_exop_refresh.phpt +++ b/ext/ldap/tests/ldap_exop_refresh.phpt @@ -21,15 +21,14 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); ldap_add($link, "cn=tmp,$base", array( - "objectclass" => array("person", "dynamicObject"), - "cn" => "tmp", - "sn" => "tmp" + "objectclass" => array("person", "dynamicObject"), + "cn" => "tmp", + "sn" => "tmp" )); var_dump( - ldap_exop_refresh($link, "cn=tmp,$base", 1234) + ldap_exop_refresh($link, "cn=tmp,$base", 1234) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -40,4 +39,3 @@ remove_dummy_data($link, $base); ?> --EXPECT-- int(1234) -===DONE=== diff --git a/ext/ldap/tests/ldap_exop_whoami.phpt b/ext/ldap/tests/ldap_exop_whoami.phpt index 368038f3bd..2c71848b00 100644 --- a/ext/ldap/tests/ldap_exop_whoami.phpt +++ b/ext/ldap/tests/ldap_exop_whoami.phpt @@ -17,7 +17,6 @@ var_dump( ldap_exop_whoami($link) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -28,4 +27,3 @@ remove_dummy_data($link, $base); ?> --EXPECTF-- string(%d) "dn:%s" -===DONE=== diff --git a/ext/ldap/tests/ldap_explode_dn.phpt b/ext/ldap/tests/ldap_explode_dn.phpt index 2337ac9eff..f573bcfc39 100644 --- a/ext/ldap/tests/ldap_explode_dn.phpt +++ b/ext/ldap/tests/ldap_explode_dn.phpt @@ -23,12 +23,6 @@ var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 0)); /* Explode without attributes and < > characters */ var_dump(ldap_explode_dn("cn=<bob>,dc=example,dc=com", 1)); -/* Too few parameters */ -ldap_explode_dn("cn=bob,dc=example,dc=com"); - -/* Too many parameters */ -ldap_explode_dn("cn=bob,dc=example,dc=com", 1, 1); - /* Bad DN value with attributes */ var_dump(ldap_explode_dn("bob,dc=example,dc=com", 0)); @@ -38,7 +32,7 @@ var_dump(ldap_explode_dn("bob,dc=example,dc=com", 1)); echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- array(4) { ["count"]=> int(3) @@ -85,10 +79,6 @@ array(5) { } bool(false) bool(false) - -Warning: ldap_explode_dn() expects exactly 2 parameters, 1 given in %s on line %d - -Warning: ldap_explode_dn() expects exactly 2 parameters, 3 given in %s on line %d bool(false) bool(false) Done diff --git a/ext/ldap/tests/ldap_first_attribute_basic.phpt b/ext/ldap/tests/ldap_first_attribute_basic.phpt index eec67c5f90..81bc538aea 100644 --- a/ext/ldap/tests/ldap_first_attribute_basic.phpt +++ b/ext/ldap/tests/ldap_first_attribute_basic.phpt @@ -15,10 +15,9 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)", array("objectClass")); $entry = ldap_first_entry($link, $result); var_dump( - ldap_first_attribute($link, $entry) + ldap_first_attribute($link, $entry) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -28,4 +27,3 @@ remove_dummy_data($link, $base); ?> --EXPECT-- string(11) "objectClass" -===DONE=== diff --git a/ext/ldap/tests/ldap_first_attribute_error.phpt b/ext/ldap/tests/ldap_first_attribute_error.phpt index f7016c539f..79138669bc 100644 --- a/ext/ldap/tests/ldap_first_attribute_error.phpt +++ b/ext/ldap/tests/ldap_first_attribute_error.phpt @@ -10,14 +10,11 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect($host, $port); -var_dump(ldap_first_attribute($link)); -var_dump(ldap_first_attribute($link, $link)); +try { + var_dump(ldap_first_attribute($link, $link)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> -===DONE=== ---EXPECTF-- -Warning: ldap_first_attribute() expects %s 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_first_attribute(): supplied resource is not a valid ldap result entry resource in %s on line %d -bool(false) -===DONE=== +--EXPECT-- +ldap_first_attribute(): supplied resource is not a valid ldap result entry resource diff --git a/ext/ldap/tests/ldap_first_entry_basic.phpt b/ext/ldap/tests/ldap_first_entry_basic.phpt index 5ba6ac42a4..94d46d6d87 100644 --- a/ext/ldap/tests/ldap_first_entry_basic.phpt +++ b/ext/ldap/tests/ldap_first_entry_basic.phpt @@ -14,11 +14,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=person)"); var_dump( - $entry = ldap_first_entry($link, $result), - ldap_get_values($link, $entry, 'sn') + $entry = ldap_first_entry($link, $result), + ldap_get_values($link, $entry, 'sn') ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -34,4 +33,3 @@ array(2) { ["count"]=> int(1) } -===DONE=== diff --git a/ext/ldap/tests/ldap_first_entry_error.phpt b/ext/ldap/tests/ldap_first_entry_error.phpt deleted file mode 100644 index 9f232e0e8f..0000000000 --- a/ext/ldap/tests/ldap_first_entry_error.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ldap_first_entry() - Testing ldap_first_entry() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_first_entry($link)); -var_dump(ldap_first_entry($link, $link, "Additional data")); -var_dump(ldap_first_entry($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_first_entry() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_first_entry() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: ldap_first_entry(): supplied resource is not a valid ldap result resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_first_reference_basic.phpt b/ext/ldap/tests/ldap_first_reference_basic.phpt index 9c83c9127d..0e41ee2458 100644 --- a/ext/ldap/tests/ldap_first_reference_basic.phpt +++ b/ext/ldap/tests/ldap_first_reference_basic.phpt @@ -23,7 +23,6 @@ $refs = null; ldap_parse_reference($link, $ref, $refs); var_dump($refs); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -39,4 +38,3 @@ array(1) { [0]=> string(%d) "cn=userA,%s" } -===DONE=== diff --git a/ext/ldap/tests/ldap_first_reference_error.phpt b/ext/ldap/tests/ldap_first_reference_error.phpt deleted file mode 100644 index d5541e10fc..0000000000 --- a/ext/ldap/tests/ldap_first_reference_error.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ldap_first_reference() - Testing ldap_first_reference() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_first_reference($link)); -var_dump(ldap_first_reference($link, $link, "Additional data")); -var_dump(ldap_first_reference($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_first_reference() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_first_reference() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: ldap_first_reference(): supplied resource is not a valid ldap result resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_free_result_basic.phpt b/ext/ldap/tests/ldap_free_result_basic.phpt index ff2f5402c3..dead9a62d3 100644 --- a/ext/ldap/tests/ldap_free_result_basic.phpt +++ b/ext/ldap/tests/ldap_free_result_basic.phpt @@ -15,7 +15,6 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=person)"); var_dump(ldap_free_result($result)); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -25,4 +24,3 @@ remove_dummy_data($link, $base); ?> --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_free_result_error.phpt b/ext/ldap/tests/ldap_free_result_error.phpt deleted file mode 100644 index 05623d62d0..0000000000 --- a/ext/ldap/tests/ldap_free_result_error.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ldap_free_result() - Testing ldap_free_result() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_free_result($link)); -var_dump(ldap_free_result($link, "Additional data")); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_free_result(): supplied resource is not a valid ldap result resource in %s on line %d -bool(false) - -Warning: ldap_free_result() expects exactly 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_get_attributes_basic.phpt b/ext/ldap/tests/ldap_get_attributes_basic.phpt index b831a7f164..0d11bce706 100644 --- a/ext/ldap/tests/ldap_get_attributes_basic.phpt +++ b/ext/ldap/tests/ldap_get_attributes_basic.phpt @@ -15,10 +15,9 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(o=test)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_get_attributes($link, $entry) + ldap_get_attributes($link, $entry) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -51,4 +50,3 @@ array(5) { ["count"]=> int(2) } -===DONE=== diff --git a/ext/ldap/tests/ldap_get_attributes_error.phpt b/ext/ldap/tests/ldap_get_attributes_error.phpt deleted file mode 100644 index 465ba4fd72..0000000000 --- a/ext/ldap/tests/ldap_get_attributes_error.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ldap_get_attributes() - Testing ldap_get_attributes() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_get_attributes($link)); -var_dump(ldap_get_attributes($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_get_attributes() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_get_attributes(): supplied resource is not a valid ldap result entry resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_get_dn_basic.phpt b/ext/ldap/tests/ldap_get_dn_basic.phpt index 38c252c5bb..14865ffe3c 100644 --- a/ext/ldap/tests/ldap_get_dn_basic.phpt +++ b/ext/ldap/tests/ldap_get_dn_basic.phpt @@ -15,10 +15,9 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_get_dn($link, $entry) + ldap_get_dn($link, $entry) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -28,4 +27,3 @@ remove_dummy_data($link, $base); ?> --EXPECTF-- string(%d) "%s" -===DONE=== diff --git a/ext/ldap/tests/ldap_get_dn_error.phpt b/ext/ldap/tests/ldap_get_dn_error.phpt deleted file mode 100644 index 71df6a3da1..0000000000 --- a/ext/ldap/tests/ldap_get_dn_error.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ldap_get_dn() - Testing ldap_get_dn() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_get_dn($link)); -var_dump(ldap_get_dn($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_get_dn() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_get_dn(): supplied resource is not a valid ldap result entry resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_get_entries_basic.phpt b/ext/ldap/tests/ldap_get_entries_basic.phpt index 3efa818ee2..bba2f08c69 100644 --- a/ext/ldap/tests/ldap_get_entries_basic.phpt +++ b/ext/ldap/tests/ldap_get_entries_basic.phpt @@ -14,13 +14,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=test)") - ) + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=test)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -60,4 +59,3 @@ array(2) { string(%d) "o=test,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_get_entries_error.phpt b/ext/ldap/tests/ldap_get_entries_error.phpt deleted file mode 100644 index 7e0f4c0b98..0000000000 --- a/ext/ldap/tests/ldap_get_entries_error.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -ldap_get_entries() - ldap_get_entries() operation that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); - -// Too few parameters -var_dump(ldap_get_entries($link)); - -// Too many parameters -var_dump(ldap_get_entries($link, $link, "Additional data")); - -// Bad parameter -var_dump(ldap_get_entries($link, "string")); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_get_entries() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_get_entries() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: ldap_get_entries() expects parameter 2 to be resource, string given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_get_entries_variation.phpt b/ext/ldap/tests/ldap_get_entries_variation.phpt index 87d155a94c..9dd45b6282 100644 --- a/ext/ldap/tests/ldap_get_entries_variation.phpt +++ b/ext/ldap/tests/ldap_get_entries_variation.phpt @@ -14,13 +14,12 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_get_entries( - $link, - ldap_search($link, "$base", "(o=my-unexisting-domain)") - ) + ldap_get_entries( + $link, + ldap_search($link, "$base", "(o=my-unexisting-domain)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -33,4 +32,3 @@ array(1) { ["count"]=> int(0) } -===DONE=== diff --git a/ext/ldap/tests/ldap_get_option_basic.phpt b/ext/ldap/tests/ldap_get_option_basic.phpt index 3136a5acb8..e9aa7cfc4f 100644 --- a/ext/ldap/tests/ldap_get_option_basic.phpt +++ b/ext/ldap/tests/ldap_get_option_basic.phpt @@ -14,12 +14,10 @@ $option = null; ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump( - ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option), - $option + ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option), + $option ); ?> -===DONE=== --EXPECT-- bool(true) int(3) -===DONE=== diff --git a/ext/ldap/tests/ldap_get_option_controls.phpt b/ext/ldap/tests/ldap_get_option_controls.phpt index abe35497d6..813f33e069 100644 --- a/ext/ldap/tests/ldap_get_option_controls.phpt +++ b/ext/ldap/tests/ldap_get_option_controls.phpt @@ -16,49 +16,48 @@ insert_dummy_data($link, $base); function build_ctrl_paged_value($int, $cookie) { - // This is basic and will only work for small values - $hex = ''; - if (!empty($int)) { - $str = sprintf("%'.02x", $int); - $hex .= '02'.sprintf("%'.02x%s", strlen($str)/2, $str); - } - $hex .= '04'.sprintf("%'.02x", strlen($cookie)).bin2hex($cookie); - return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); + // This is basic and will only work for small values + $hex = ''; + if (!empty($int)) { + $str = sprintf("%'.02x", $int); + $hex .= '02'.sprintf("%'.02x%s", strlen($str)/2, $str); + } + $hex .= '04'.sprintf("%'.02x", strlen($cookie)).bin2hex($cookie); + return hex2bin('30'.sprintf("%'.02x", strlen($hex)/2).$hex); } $controls_set = array( - array( - 'oid' => LDAP_CONTROL_PAGEDRESULTS, - 'iscritical' => TRUE, - 'value' => build_ctrl_paged_value(1, 'opaque') - ) + array( + 'oid' => LDAP_CONTROL_PAGEDRESULTS, + 'iscritical' => TRUE, + 'value' => build_ctrl_paged_value(1, 'opaque') + ) ); $controls_set2 = array( - array( - 'oid' => LDAP_CONTROL_PAGEDRESULTS, - 'iscritical' => TRUE, - 'value' => array( - 'size' => 1, - 'cookie' => '', - ) - ) + array( + 'oid' => LDAP_CONTROL_PAGEDRESULTS, + 'iscritical' => TRUE, + 'value' => array( + 'size' => 1, + 'cookie' => '', + ) + ) ); var_dump( - bin2hex($controls_set[0]['value']), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - $controls_get, - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), - $controls_get, - $result = ldap_search($link, $base, "(objectClass=person)", array('cn')), - ldap_get_entries($link, $result)['count'], - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()), - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get) + bin2hex($controls_set[0]['value']), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + $controls_get, + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_set2), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get), + $controls_get, + $result = ldap_search($link, $base, "(objectClass=person)", array('cn')), + ldap_get_entries($link, $result)['count'], + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array()), + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $controls_get) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -109,4 +108,3 @@ resource(%d) of type (ldap result) int(1) bool(true) bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_get_option_error.phpt b/ext/ldap/tests/ldap_get_option_error.phpt deleted file mode 100644 index cf7a0e5d49..0000000000 --- a/ext/ldap/tests/ldap_get_option_error.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -ldap_get_option() - ldap_get_option() operation that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -$option = null; - -// Too few parameters -var_dump(ldap_get_option()); -var_dump(ldap_get_option($link)); -var_dump(ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION)); - -// Too many parameters -var_dump( - ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option, "Additional data"), - $option -); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_get_option() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_get_option() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_get_option() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_get_option() expects exactly 3 parameters, 4 given in %s on line %d -NULL -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_get_option_package_basic.phpt b/ext/ldap/tests/ldap_get_option_package_basic.phpt index af8146dc9c..1ad9442a38 100644 --- a/ext/ldap/tests/ldap_get_option_package_basic.phpt +++ b/ext/ldap/tests/ldap_get_option_package_basic.phpt @@ -14,8 +14,6 @@ var_dump(in_array($optionval, ['GnuTLS', 'OpenSSL', 'MozNSS'])); // This is a read-only option. var_dump(ldap_set_option($link, LDAP_OPT_X_TLS_PACKAGE, 'foo')); ?> -===DONE=== --EXPECT-- bool(true) bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_get_option_variation.phpt b/ext/ldap/tests/ldap_get_option_variation.phpt index a18318849f..80384475b4 100644 --- a/ext/ldap/tests/ldap_get_option_variation.phpt +++ b/ext/ldap/tests/ldap_get_option_variation.phpt @@ -13,8 +13,8 @@ $link = ldap_connect($host, $port); $option = null; $controls = array( - array("oid" => "1.2.752.58.10.1", "iscritical" => true), - array("oid" => "1.2.752.58.1.10", "value" => "magic"), + array("oid" => "1.2.752.58.10.1", "iscritical" => true), + array("oid" => "1.2.752.58.1.10", "value" => "magic"), ); ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); @@ -28,27 +28,26 @@ ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls); ldap_set_option($link, LDAP_OPT_RESTART, false); var_dump( - ldap_get_option($link, LDAP_OPT_DEREF, $option), - $option, - ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), - $option, - ldap_get_option($link, LDAP_OPT_TIMEOUT, $option), - $option, - ldap_get_option($link, LDAP_OPT_REFERRALS, $option), - $option, - ldap_get_option($link, LDAP_OPT_RESTART, $option), - $option, - ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option), - $option, - ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option), - $option + ldap_get_option($link, LDAP_OPT_DEREF, $option), + $option, + ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), + $option, + ldap_get_option($link, LDAP_OPT_TIMEOUT, $option), + $option, + ldap_get_option($link, LDAP_OPT_REFERRALS, $option), + $option, + ldap_get_option($link, LDAP_OPT_RESTART, $option), + $option, + ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option), + $option, + ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option), + $option ); ?> -===DONE=== --EXPECT-- bool(true) int(0) @@ -106,4 +105,3 @@ array(2) { string(5) "magic" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_get_values_len_basic.phpt b/ext/ldap/tests/ldap_get_values_len_basic.phpt index 33084f48ab..eaf66c0fbc 100644 --- a/ext/ldap/tests/ldap_get_values_len_basic.phpt +++ b/ext/ldap/tests/ldap_get_values_len_basic.phpt @@ -15,10 +15,9 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(o=test)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_get_values_len($link, $entry, "o") + ldap_get_values_len($link, $entry, "o") ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -33,4 +32,3 @@ array(2) { ["count"]=> int(1) } -===DONE=== diff --git a/ext/ldap/tests/ldap_get_values_len_error.phpt b/ext/ldap/tests/ldap_get_values_len_error.phpt index 8bcaee070f..df1a380082 100644 --- a/ext/ldap/tests/ldap_get_values_len_error.phpt +++ b/ext/ldap/tests/ldap_get_values_len_error.phpt @@ -15,14 +15,8 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); -// Too few parameters -var_dump(ldap_get_values_len($link)); -var_dump(ldap_get_values_len($link, $entry)); -var_dump(ldap_get_values_len($link, $entry, "weirdAttribute", "Additional data")); - var_dump(ldap_get_values_len($link, $entry, "inexistentAttribute")); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -31,15 +25,5 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -Warning: ldap_get_values_len() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_get_values_len() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_get_values_len() expects exactly 3 parameters, 4 given in %s on line %d -NULL - Warning: ldap_get_values_len(): Cannot get the value(s) of attribute %s in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_list_basic.phpt b/ext/ldap/tests/ldap_list_basic.phpt index 1aadab6a17..f4d8bda31b 100644 --- a/ext/ldap/tests/ldap_list_basic.phpt +++ b/ext/ldap/tests/ldap_list_basic.phpt @@ -16,11 +16,10 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_list($link, "$base", "(objectClass=person)"), - ldap_get_entries($link, $result) + $result = ldap_list($link, "$base", "(objectClass=person)"), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -147,4 +146,3 @@ array(3) { string(%d) "cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_list_error.phpt b/ext/ldap/tests/ldap_list_error.phpt deleted file mode 100644 index 817622e725..0000000000 --- a/ext/ldap/tests/ldap_list_error.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ldap_list() - operation that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -include "connect.inc"; - -$link = ldap_connect($host, $port); - -// Too few parameters -var_dump(ldap_list()); -var_dump(ldap_list($link)); -var_dump(ldap_list($link, $link)); - -// Too many parameters -var_dump(ldap_list($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data")); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_list() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_list() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_list() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_list() expects at most 9 parameters, 10 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_add_basic.phpt b/ext/ldap/tests/ldap_mod_add_basic.phpt index a05a6a0418..9096f3eb63 100644 --- a/ext/ldap/tests/ldap_mod_add_basic.phpt +++ b/ext/ldap/tests/ldap_mod_add_basic.phpt @@ -14,18 +14,17 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "Domain description", + "description" => "Domain description", ); var_dump( - ldap_mod_add($link, "o=test,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "o=test,$base", "(Description=Domain description)") - ) + ldap_mod_add($link, "o=test,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -76,4 +75,3 @@ array(2) { string(%d) "o=test,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_add_error.phpt b/ext/ldap/tests/ldap_mod_add_error.phpt index 4bfbaa5551..7dd26616dc 100644 --- a/ext/ldap/tests/ldap_mod_add_error.phpt +++ b/ext/ldap/tests/ldap_mod_add_error.phpt @@ -12,14 +12,6 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -// Too few parameters -var_dump(ldap_mod_add()); -var_dump(ldap_mod_add($link)); -var_dump(ldap_mod_add($link, "$base")); - -// Too many parameters -var_dump(ldap_mod_add($link, "$base", array(), [], "Additional data")); - // DN not found var_dump(ldap_mod_add($link, "dc=my-domain,$base", array())); @@ -27,12 +19,12 @@ var_dump(ldap_mod_add($link, "dc=my-domain,$base", array())); var_dump(ldap_mod_add($link, "weirdAttribute=val", array())); $entry = array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", ); ldap_add($link, "dc=my-domain,$base", $entry); @@ -47,7 +39,6 @@ $entry2["weirdAttribute"] = "weirdVal"; var_dump(ldap_mod_add($link, "dc=my-domain,$base", $entry2)); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -57,18 +48,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_mod_add() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_mod_add() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_mod_add() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_mod_add() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: ldap_mod_add(): Modify: No such object in %s on line %d bool(false) @@ -80,4 +59,3 @@ bool(false) Warning: ldap_mod_add(): Modify: Undefined attribute type in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_del_basic.phpt b/ext/ldap/tests/ldap_mod_del_basic.phpt index 788ac0adb3..bafc190968 100644 --- a/ext/ldap/tests/ldap_mod_del_basic.phpt +++ b/ext/ldap/tests/ldap_mod_del_basic.phpt @@ -14,18 +14,17 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "user A" + "description" => "user A" ); var_dump( - ldap_mod_del($link, "cn=userA,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(description=user A)") - ) + ldap_mod_del($link, "cn=userA,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(description=user A)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -40,4 +39,3 @@ array(1) { ["count"]=> int(0) } -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_del_error.phpt b/ext/ldap/tests/ldap_mod_del_error.phpt index 129d6472c1..6df125c1b7 100644 --- a/ext/ldap/tests/ldap_mod_del_error.phpt +++ b/ext/ldap/tests/ldap_mod_del_error.phpt @@ -12,14 +12,6 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -// Too few parameters -var_dump(ldap_mod_del()); -var_dump(ldap_mod_del($link)); -var_dump(ldap_mod_del($link, "$base")); - -// Too many parameters -var_dump(ldap_mod_del($link, "$base", array(), [], "Additional data")); - // DN not found var_dump(ldap_mod_del($link, "dc=my-domain,$base", array())); @@ -29,7 +21,6 @@ var_dump(ldap_mod_del($link, "weirdAttribute=val", array())); // Invalid attributes var_dump(ldap_mod_del($link, "$base", array('dc'))); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -39,18 +30,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_mod_del() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_mod_del() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_mod_del() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_mod_del() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: ldap_mod_del(): Modify: No such object in %s on line %d bool(false) @@ -59,4 +38,3 @@ bool(false) Warning: ldap_mod_del(): Unknown attribute in the data in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_ext.phpt b/ext/ldap/tests/ldap_mod_ext.phpt index 391ecbf909..0ca091fed8 100644 --- a/ext/ldap/tests/ldap_mod_ext.phpt +++ b/ext/ldap/tests/ldap_mod_ext.phpt @@ -19,41 +19,40 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "Domain description", + "description" => "Domain description", ); var_dump( - $result = ldap_mod_add_ext($link, "o=test,$base", $entry, - [ - ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - ldap_get_entries( - $link, - ldap_search($link, "o=test,$base", "(Description=Domain description)") - ), - $result = ldap_mod_del_ext($link, "o=test,$base", $entry, - [ - ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], - ] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls, - ldap_get_entries( - $link, - ldap_search($link, "o=test,$base", "(Description=Domain description)") - ) + $result = ldap_mod_add_ext($link, "o=test,$base", $entry, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ), + $result = ldap_mod_del_ext($link, "o=test,$base", $entry, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls, + ldap_get_entries( + $link, + ldap_search($link, "o=test,$base", "(Description=Domain description)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -169,4 +168,3 @@ array(1) { ["count"]=> int(0) } -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_replace_basic.phpt b/ext/ldap/tests/ldap_mod_replace_basic.phpt index 8e9fd4dcad..0dd9f2b1ea 100644 --- a/ext/ldap/tests/ldap_mod_replace_basic.phpt +++ b/ext/ldap/tests/ldap_mod_replace_basic.phpt @@ -14,18 +14,17 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "description" => "user X" + "description" => "user X" ); var_dump( - ldap_mod_replace($link, "cn=userA,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(description=user X)", array("description")) - ) + ldap_mod_replace($link, "cn=userA,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(description=user X)", array("description")) + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -56,4 +55,3 @@ array(2) { string(%d) "cn=userA,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_mod_replace_error.phpt b/ext/ldap/tests/ldap_mod_replace_error.phpt index 4f435b13d2..6a12107651 100644 --- a/ext/ldap/tests/ldap_mod_replace_error.phpt +++ b/ext/ldap/tests/ldap_mod_replace_error.phpt @@ -12,14 +12,6 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -// Too few parameters -var_dump(ldap_mod_replace()); -var_dump(ldap_mod_replace($link)); -var_dump(ldap_mod_replace($link, "$base")); - -// Too many parameters -var_dump(ldap_mod_replace($link, "$base", array(), [], "Additional data")); - // DN not found var_dump(ldap_mod_replace($link, "dc=my-domain,$base", array())); @@ -29,7 +21,6 @@ var_dump(ldap_mod_replace($link, "weirdAttribute=val", array())); // Invalid attributes var_dump(ldap_mod_replace($link, "$base", array('dc'))); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -37,18 +28,6 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ?> --EXPECTF-- -Warning: ldap_mod_replace() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_mod_replace() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_mod_replace() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_mod_replace() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: ldap_mod_replace(): Modify: No such object in %s on line %d bool(false) @@ -57,4 +36,3 @@ bool(false) Warning: ldap_mod_replace(): Unknown attribute in the data in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_modify_basic.phpt b/ext/ldap/tests/ldap_modify_basic.phpt index 2f6a51af4d..2589953147 100644 --- a/ext/ldap/tests/ldap_modify_basic.phpt +++ b/ext/ldap/tests/ldap_modify_basic.phpt @@ -14,22 +14,21 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $entry = array( - "objectClass" => array( - "top", - "organization"), - "o" => "test", - "description" => "Domain description", + "objectClass" => array( + "top", + "organization"), + "o" => "test", + "description" => "Domain description", ); var_dump( - ldap_modify($link, "o=test,$base", $entry), - ldap_get_entries( - $link, - ldap_search($link, "$base", "(Description=Domain description)") - ) + ldap_modify($link, "o=test,$base", $entry), + ldap_get_entries( + $link, + ldap_search($link, "$base", "(Description=Domain description)") + ) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -80,4 +79,3 @@ array(2) { string(%d) "o=test,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_modify_batch_basic.phpt b/ext/ldap/tests/ldap_modify_batch_basic.phpt index 0bec0e03c4..41d7c0f15f 100644 --- a/ext/ldap/tests/ldap_modify_batch_basic.phpt +++ b/ext/ldap/tests/ldap_modify_batch_basic.phpt @@ -14,30 +14,29 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); $mods = array( - array( - "attrib" => "telephoneNumber", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array( - "+1 555 5551717" - ) - ), - array( - "attrib" => "sn", - "modtype" => LDAP_MODIFY_BATCH_REPLACE, - "values" => array("Brown-Smith") - ), - array( - "attrib" => "description", - "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL - ) + array( + "attrib" => "telephoneNumber", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array( + "+1 555 5551717" + ) + ), + array( + "attrib" => "sn", + "modtype" => LDAP_MODIFY_BATCH_REPLACE, + "values" => array("Brown-Smith") + ), + array( + "attrib" => "description", + "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL + ) ); var_dump( - ldap_modify_batch($link, "cn=userA,$base", $mods), - ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)")) + ldap_modify_batch($link, "cn=userA,$base", $mods), + ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)")) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -106,4 +105,3 @@ array(2) { string(%d) "cn=userA,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_modify_batch_error.phpt b/ext/ldap/tests/ldap_modify_batch_error.phpt index a2d9ef9deb..627d116d97 100644 --- a/ext/ldap/tests/ldap_modify_batch_error.phpt +++ b/ext/ldap/tests/ldap_modify_batch_error.phpt @@ -13,21 +13,13 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); $addGivenName = array( - array( - "attrib" => "givenName", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array("Jack") - ) + array( + "attrib" => "givenName", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array("Jack") + ) ); -// Too few parameters -var_dump(ldap_modify_batch()); -var_dump(ldap_modify_batch($link)); -var_dump(ldap_modify_batch($link, "$base")); - -// Too many parameters -var_dump(ldap_modify_batch($link, "$base", $addGivenName, [], "Invalid additional parameter")); - // DN not found var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName)); @@ -36,39 +28,38 @@ var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName)); // prepare $entry = array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", ); ldap_add($link, "dc=my-domain,$base", $entry); // invalid domain $mods = array( - array( - "attrib" => "dc", - "modtype" => LDAP_MODIFY_BATCH_REPLACE, - "values" => array("Wrong Domain") - ) + array( + "attrib" => "dc", + "modtype" => LDAP_MODIFY_BATCH_REPLACE, + "values" => array("Wrong Domain") + ) ); var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); // invalid attribute $mods = array( - array( - "attrib" => "weirdAttribute", - "modtype" => LDAP_MODIFY_BATCH_ADD, - "values" => array("weirdVal", "anotherWeirdval") - ) + array( + "attrib" => "weirdAttribute", + "modtype" => LDAP_MODIFY_BATCH_ADD, + "values" => array("weirdVal", "anotherWeirdval") + ) ); var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -78,18 +69,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_modify_batch() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_modify_batch() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_modify_batch() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_modify_batch() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d bool(false) @@ -101,4 +80,3 @@ bool(false) Warning: ldap_modify_batch(): Batch Modify: Undefined attribute type in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_modify_error.phpt b/ext/ldap/tests/ldap_modify_error.phpt index 31069bb98c..682abf7504 100644 --- a/ext/ldap/tests/ldap_modify_error.phpt +++ b/ext/ldap/tests/ldap_modify_error.phpt @@ -12,14 +12,6 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -// Too few parameters -var_dump(ldap_modify()); -var_dump(ldap_modify($link)); -var_dump(ldap_modify($link, "$base")); - -// Too many parameters -var_dump(ldap_modify($link, "$base", array(), [], "Additional data")); - // DN not found var_dump(ldap_modify($link, "cn=not-found,$base", array())); @@ -27,12 +19,12 @@ var_dump(ldap_modify($link, "cn=not-found,$base", array())); var_dump(ldap_modify($link, "weirdAttribute=val", array())); $entry = array( - "objectClass" => array( - "top", - "dcObject", - "organization"), - "dc" => "my-domain", - "o" => "my-domain", + "objectClass" => array( + "top", + "dcObject", + "organization"), + "dc" => "my-domain", + "o" => "my-domain", ); ldap_add($link, "dc=my-domain,$base", $entry); @@ -47,7 +39,6 @@ $entry2["weirdAttribute"] = "weirdVal"; var_dump(ldap_modify($link, "dc=my-domain,$base", $entry2)); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -57,18 +48,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); ldap_delete($link, "dc=my-domain,$base"); ?> --EXPECTF-- -Warning: ldap_modify() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_modify() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_modify() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_modify() expects at most 4 parameters, 5 given in %s on line %d -NULL - Warning: ldap_modify(): Modify: No such object in %s on line %d bool(false) @@ -80,4 +59,3 @@ bool(false) Warning: ldap_modify(): Modify: Undefined attribute type in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_next_attribute_basic.phpt b/ext/ldap/tests/ldap_next_attribute_basic.phpt index 1acc0e1ad1..4c9584ee0b 100644 --- a/ext/ldap/tests/ldap_next_attribute_basic.phpt +++ b/ext/ldap/tests/ldap_next_attribute_basic.phpt @@ -16,13 +16,12 @@ $result = ldap_search($link, "$base", "(cn=userC)"); $entry = ldap_first_entry($link, $result); $attribute = ldap_first_attribute($link, $entry); var_dump( - ldap_next_attribute($link, $entry), - ldap_next_attribute($link, $entry), - ldap_next_attribute($link, $entry), - ldap_next_attribute($link, $entry) + ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry), + ldap_next_attribute($link, $entry) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -35,4 +34,3 @@ string(%d) "%s" string(%d) "%s" string(%d) "%s" bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_next_attribute_error.phpt b/ext/ldap/tests/ldap_next_attribute_error.phpt index 0bedf8c33f..ffe1222626 100644 --- a/ext/ldap/tests/ldap_next_attribute_error.phpt +++ b/ext/ldap/tests/ldap_next_attribute_error.phpt @@ -15,12 +15,9 @@ insert_dummy_data($link, $base); $result = ldap_search($link, "$base", "(objectclass=organization)"); $entry = ldap_first_entry($link, $result); var_dump( - ldap_next_attribute($link), - ldap_next_attribute($link, $link), - ldap_next_attribute($link, $entry) + ldap_next_attribute($link, $entry) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -29,12 +26,5 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -Warning: ldap_next_attribute() expects %s 2 parameters, 1 given in %s on line %d - -Warning: ldap_next_attribute(): supplied resource is not a valid ldap result entry resource in %s on line %d - -Warning: ldap_next_attribute(): called before calling ldap_first_attribute() or no attributes found in result entry in %s on line %d -NULL -bool(false) +Warning: ldap_next_attribute(): Called before calling ldap_first_attribute() or no attributes found in result entry in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_next_entry_basic.phpt b/ext/ldap/tests/ldap_next_entry_basic.phpt index dd43715239..d8f03ce291 100644 --- a/ext/ldap/tests/ldap_next_entry_basic.phpt +++ b/ext/ldap/tests/ldap_next_entry_basic.phpt @@ -15,12 +15,11 @@ insert_dummy_data($link, $base); $result = ldap_list($link, "$base", "(objectClass=person)"); $entry = ldap_first_entry($link, $result); var_dump( - $entry = ldap_next_entry($link, $entry), - ldap_get_values($link, $entry, 'sn'), - $entry = ldap_next_entry($link, $entry) + $entry = ldap_next_entry($link, $entry), + ldap_get_values($link, $entry, 'sn'), + $entry = ldap_next_entry($link, $entry) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -37,4 +36,3 @@ array(2) { int(1) } bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_next_entry_error.phpt b/ext/ldap/tests/ldap_next_entry_error.phpt deleted file mode 100644 index 59e9cdcab5..0000000000 --- a/ext/ldap/tests/ldap_next_entry_error.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ldap_next_entry() - Testing ldap_next_entry() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_next_entry($link)); -var_dump(ldap_next_entry($link, $link, "Additional data")); -var_dump(ldap_next_entry($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_next_entry() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_next_entry() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: ldap_next_entry(): supplied resource is not a valid ldap result entry resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_next_reference_basic.phpt b/ext/ldap/tests/ldap_next_reference_basic.phpt index 2476e02c57..7af26ff91c 100644 --- a/ext/ldap/tests/ldap_next_reference_basic.phpt +++ b/ext/ldap/tests/ldap_next_reference_basic.phpt @@ -28,7 +28,6 @@ var_dump($ref2 = ldap_next_reference($link, $ref)); ldap_parse_reference($link, $ref2, $refs); var_dump($refs); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -45,4 +44,3 @@ array(1) { [0]=> string(%d) "cn=userB,%s" } -===DONE=== diff --git a/ext/ldap/tests/ldap_next_reference_error.phpt b/ext/ldap/tests/ldap_next_reference_error.phpt deleted file mode 100644 index 0e47c5ef5c..0000000000 --- a/ext/ldap/tests/ldap_next_reference_error.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ldap_next_reference() - Testing ldap_next_reference() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_next_reference($link)); -var_dump(ldap_next_reference($link, $link, "Additional data")); -var_dump(ldap_next_reference($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_next_reference() expects exactly 2 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_next_reference() expects exactly 2 parameters, 3 given in %s on line %d -NULL - -Warning: ldap_next_reference(): supplied resource is not a valid ldap result entry resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_option_reqcert_basic.phpt b/ext/ldap/tests/ldap_option_reqcert_basic.phpt index 04ced6ecbe..e774a0e03f 100644 --- a/ext/ldap/tests/ldap_option_reqcert_basic.phpt +++ b/ext/ldap/tests/ldap_option_reqcert_basic.phpt @@ -18,7 +18,5 @@ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(@ldap_bind($link, $user, $passwd)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_option_reqcert_error.phpt b/ext/ldap/tests/ldap_option_reqcert_error.phpt index 477c4aba39..50e542a080 100644 --- a/ext/ldap/tests/ldap_option_reqcert_error.phpt +++ b/ext/ldap/tests/ldap_option_reqcert_error.phpt @@ -1,5 +1,5 @@ --TEST-- -ldap_option_reqcert_error() - A test to check if ldap cant connect to a LDAP server with a invalid certificate with certificate checking enabled +ldap_option_reqcert_error() - A test to check if ldap can't connect to a LDAP server with a invalid certificate with certificate checking enabled --CREDITS-- Edwin Hoksberg <edwin@edwinhoksberg.nl> --SKIPIF-- @@ -18,7 +18,5 @@ ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(@ldap_bind($link, $user, $passwd)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_parse_reference_basic.phpt b/ext/ldap/tests/ldap_parse_reference_basic.phpt index 249f2959f3..d5aeef8a59 100644 --- a/ext/ldap/tests/ldap_parse_reference_basic.phpt +++ b/ext/ldap/tests/ldap_parse_reference_basic.phpt @@ -21,11 +21,10 @@ $result = ldap_search($link, "$base", "(cn=*)"); $ref = ldap_first_reference($link, $result); $refs = null; var_dump( - ldap_parse_reference($link, $ref, $refs), - $refs + ldap_parse_reference($link, $ref, $refs), + $refs ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -42,4 +41,3 @@ array(1) { [0]=> string(%d) "cn=userA,%s" } -===DONE=== diff --git a/ext/ldap/tests/ldap_parse_reference_error.phpt b/ext/ldap/tests/ldap_parse_reference_error.phpt deleted file mode 100644 index 9d180e717d..0000000000 --- a/ext/ldap/tests/ldap_parse_reference_error.phpt +++ /dev/null @@ -1,31 +0,0 @@ ---TEST-- -ldap_parse_reference() - ldap_parse_reference() operations that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; -$link = ldap_connect($host, $port); -$refs = null; -var_dump( - ldap_parse_reference($link, $link), - ldap_parse_reference($link, $link, $refs), - ldap_parse_reference($link, $refs, $refs, "Additional data"), - $refs -); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_parse_reference() expects exactly 3 parameters, 2 given in %s on line %d - -Warning: ldap_parse_reference(): supplied resource is not a valid ldap result entry resource in %s on line %d - -Warning: ldap_parse_reference() expects exactly 3 parameters, 4 given in %s on line %d -NULL -bool(false) -NULL -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_parse_result_basic.phpt b/ext/ldap/tests/ldap_parse_result_basic.phpt index e2a975d5b1..ed7047164b 100644 --- a/ext/ldap/tests/ldap_parse_result_basic.phpt +++ b/ext/ldap/tests/ldap_parse_result_basic.phpt @@ -20,11 +20,10 @@ ldap_add($link, "cn=userref,$base", array( $result = ldap_search($link, "cn=userref,$base", "(cn=user*)"); $errcode = $dn = $errmsg = $refs = null; var_dump( - ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs), - $errcode, $dn, $errmsg, $refs + ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs), + $errcode, $dn, $errmsg, $refs ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -43,4 +42,3 @@ array(1) { [0]=> string(%d) "cn=userA,%s" } -===DONE=== diff --git a/ext/ldap/tests/ldap_parse_result_controls.phpt b/ext/ldap/tests/ldap_parse_result_controls.phpt index 8ce2328d2f..63ef9e69d7 100644 --- a/ext/ldap/tests/ldap_parse_result_controls.phpt +++ b/ext/ldap/tests/ldap_parse_result_controls.phpt @@ -19,16 +19,15 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - ldap_control_paged_result($link, 1), - $result = ldap_search($link, $dn, $filter, array('cn')), - ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls), - $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'], - $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'], - bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']), - ldap_get_entries($link, $result)['count'] + ldap_control_paged_result($link, 1), + $result = ldap_search($link, $dn, $filter, array('cn')), + ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs, $ctrls), + $ctrls[LDAP_CONTROL_PAGEDRESULTS]['oid'], + $ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['size'], + bin2hex($ctrls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']), + ldap_get_entries($link, $result)['count'] ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -45,4 +44,3 @@ string(22) "1.2.840.113556.1.4.319" int(%d) string(%d) "%s" int(1) -===DONE=== diff --git a/ext/ldap/tests/ldap_parse_result_error.phpt b/ext/ldap/tests/ldap_parse_result_error.phpt deleted file mode 100644 index 33f86f40b9..0000000000 --- a/ext/ldap/tests/ldap_parse_result_error.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -ldap_parse_result() - Testing ldap_parse_result() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; -var_dump(ldap_parse_result(null, null)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_parse_result() expects at least 3 parameters, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_read_basic.phpt b/ext/ldap/tests/ldap_read_basic.phpt index 5a6e7ed057..596c02a71e 100644 --- a/ext/ldap/tests/ldap_read_basic.phpt +++ b/ext/ldap/tests/ldap_read_basic.phpt @@ -16,11 +16,10 @@ include "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_read($link, "o=test,$base", "(o=*)"), - ldap_get_entries($link, $result) + $result = ldap_read($link, "o=test,$base", "(o=*)"), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -61,4 +60,3 @@ array(2) { string(%d) "o=test,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_read_error.phpt b/ext/ldap/tests/ldap_read_error.phpt deleted file mode 100644 index 08f6280490..0000000000 --- a/ext/ldap/tests/ldap_read_error.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -ldap_read() - operation that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -include "connect.inc"; - -$link = ldap_connect($host, $port); - -// Too few parameters -var_dump(ldap_read()); -var_dump(ldap_read($link)); -var_dump(ldap_read($link, $link)); - -// Too many parameters -var_dump(ldap_read($link, "$base", "(objectClass=*)", array(), 0, 0, 0, 0, [], "Additional data")); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_read() expects at least 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_read() expects at least 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_read() expects at least 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_read() expects at most 9 parameters, 10 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_read_variation1.phpt b/ext/ldap/tests/ldap_read_variation1.phpt index 5d65814ec0..d5c731870c 100644 --- a/ext/ldap/tests/ldap_read_variation1.phpt +++ b/ext/ldap/tests/ldap_read_variation1.phpt @@ -7,7 +7,9 @@ if (!extension_loaded('ldap')) die('skip ldap extension not available'); --FILE-- <?php $array = [123, 456, 789]; -@ldap_read(null, null, null, $array); +try { + ldap_read(null, null, null, $array); +} catch (TypeError $err) {} var_dump($array); ?> --EXPECT-- diff --git a/ext/ldap/tests/ldap_rename_basic.phpt b/ext/ldap/tests/ldap_rename_basic.phpt index c01c4318a6..f985630ac6 100644 --- a/ext/ldap/tests/ldap_rename_basic.phpt +++ b/ext/ldap/tests/ldap_rename_basic.phpt @@ -13,13 +13,12 @@ require "connect.inc"; $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true) + ldap_rename($link, "cn=userA,$base", "cn=userZ", "$base", true) ); $result = ldap_search($link, "$base", "(cn=userA)", array("cn", "sn")); $result = ldap_search($link, "$base", "(cn=userZ)", array("cn", "sn")); var_dump(ldap_get_entries($link, $result)); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -59,4 +58,3 @@ array(2) { string(%d) "cn=userZ,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_rename_error.phpt b/ext/ldap/tests/ldap_rename_error.phpt index 8a580e5c34..57c2e03e71 100644 --- a/ext/ldap/tests/ldap_rename_error.phpt +++ b/ext/ldap/tests/ldap_rename_error.phpt @@ -10,12 +10,7 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; $link = ldap_connect($host, $port); -var_dump(ldap_rename($link)); var_dump(ldap_rename($link, "cn=userNotFound,$base", "cn=userZ", "$base", true)); ?> -===DONE=== ---EXPECTF-- -Warning: ldap_rename() expects at least 5 parameters, 1 given in %s on line %d -NULL +--EXPECT-- bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_rename_ext.phpt b/ext/ldap/tests/ldap_rename_ext.phpt index bee180b6f7..e4f7d8364e 100644 --- a/ext/ldap/tests/ldap_rename_ext.phpt +++ b/ext/ldap/tests/ldap_rename_ext.phpt @@ -18,22 +18,21 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_rename_ext($link, "cn=userA,$base", "cn=userZ", "$base", TRUE, - [ - ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]], - ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]] - ] - ), - ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), - $errcode, - $errmsg, - $ctrls[LDAP_CONTROL_PRE_READ], - $ctrls[LDAP_CONTROL_POST_READ], - ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))), - ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn"))) + $result = ldap_rename_ext($link, "cn=userA,$base", "cn=userZ", "$base", TRUE, + [ + ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]], + ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['cn']]] + ] + ), + ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), + $errcode, + $errmsg, + $ctrls[LDAP_CONTROL_PRE_READ], + $ctrls[LDAP_CONTROL_POST_READ], + ldap_count_entries($link, ldap_search($link, "$base", "(cn=userA)", array("cn"))), + ldap_count_entries($link, ldap_search($link, "$base", "(cn=userZ)", array("cn"))) ); ?> -===DONE=== --CLEAN-- <?php require "connect.inc"; @@ -77,4 +76,3 @@ array(2) { } int(0) int(1) -===DONE=== diff --git a/ext/ldap/tests/ldap_sasl_bind_basic.phpt b/ext/ldap/tests/ldap_sasl_bind_basic.phpt index d85cd73a5c..3ab977b854 100644 --- a/ext/ldap/tests/ldap_sasl_bind_basic.phpt +++ b/ext/ldap/tests/ldap_sasl_bind_basic.phpt @@ -25,7 +25,6 @@ $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(ldap_sasl_bind($link, null, $sasl_passwd, 'DIGEST-MD5', 'realm', $sasl_user)); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -35,4 +34,3 @@ remove_dummy_data($link, $base); ?> --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_sasl_bind_error.phpt b/ext/ldap/tests/ldap_sasl_bind_error.phpt index 8e2e5e1d13..53a84eae1a 100644 --- a/ext/ldap/tests/ldap_sasl_bind_error.phpt +++ b/ext/ldap/tests/ldap_sasl_bind_error.phpt @@ -18,9 +18,6 @@ ldap_unbind($link); $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); -// Invalid parameter count -var_dump(ldap_sasl_bind()); - // Invalid DN var_dump(ldap_sasl_bind($link, "Invalid DN", $sasl_passwd, 'DIGEST-MD5', 'realm', $sasl_user)); @@ -35,7 +32,6 @@ var_dump(ldap_sasl_bind($link, null, $sasl_passwd, 'DIGEST-MD5', "realm", "Manag // Invalid DN syntax var_dump(ldap_sasl_bind($link, "unexistingProperty=weirdValue,$user", $sasl_passwd)); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -44,9 +40,6 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- -Warning: ldap_sasl_bind() expects at least 1 parameter, 0 given in %s on line %d -bool(false) - Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d bool(false) @@ -61,4 +54,3 @@ bool(false) Warning: ldap_sasl_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_search_basic.phpt b/ext/ldap/tests/ldap_search_basic.phpt index 618366b1a1..f7ed449c16 100644 --- a/ext/ldap/tests/ldap_search_basic.phpt +++ b/ext/ldap/tests/ldap_search_basic.phpt @@ -17,11 +17,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "$base", "(objectClass=person)"), - ldap_get_entries($link, $result) + $result = ldap_search($link, "$base", "(objectClass=person)"), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -191,4 +190,3 @@ array(4) { string(%d) "cn=userC,cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_error.phpt b/ext/ldap/tests/ldap_search_error.phpt index 795edd3180..0a260b2884 100644 --- a/ext/ldap/tests/ldap_search_error.phpt +++ b/ext/ldap/tests/ldap_search_error.phpt @@ -15,15 +15,9 @@ $link = ldap_connect($host, $port); $dn = "dc=not-found,$base"; $filter = "(dc=*)"; -$result = ldap_search(); -var_dump($result); - $result = ldap_search($link, $dn, $filter); var_dump($result); -$result = ldap_search($link, $dn, $filter, NULL); -var_dump($result); - $result = ldap_search($link, $dn, $filter, array(1 => 'top')); var_dump($result); @@ -36,17 +30,10 @@ var_dump($result); $result = ldap_search(array($link, $link), $dn, array($filter), array('top')); var_dump($result); ?> -===DONE=== --EXPECTF-- -Warning: ldap_search() expects at least 3 parameters, 0 given in %s on line %d -NULL - Warning: ldap_search(): Search: No such object in %s on line %d bool(false) -Warning: ldap_search() expects parameter 4 to be array, null given in %s on line %d -NULL - Warning: ldap_search(): Array initialization wrong in %s on line %d bool(false) @@ -58,4 +45,3 @@ bool(false) Warning: ldap_search(): Filter must either be a string, or an array with the same number of elements as the links array in %s on line %d bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_search_overrides.phpt b/ext/ldap/tests/ldap_search_overrides.phpt index 2434fe5db2..5bd351a741 100644 --- a/ext/ldap/tests/ldap_search_overrides.phpt +++ b/ext/ldap/tests/ldap_search_overrides.phpt @@ -20,21 +20,20 @@ ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44); insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER), - ldap_get_entries($link, $result) + $result = ldap_search($link, "$base", "(objectClass=person)", array(), null, 111, 22, LDAP_DEREF_NEVER), + ldap_get_entries($link, $result) ); var_dump( - ldap_get_option($link, LDAP_OPT_DEREF, $option), - $option, - ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), - $option, - ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), - $option + ldap_get_option($link, LDAP_OPT_DEREF, $option), + $option, + ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option), + $option, + ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option), + $option ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -212,4 +211,3 @@ bool(true) int(33) bool(true) int(44) -===DONE=== diff --git a/ext/ldap/tests/ldap_search_paged_result_controls.phpt b/ext/ldap/tests/ldap_search_paged_result_controls.phpt index 2187a54148..f60acd3e0c 100644 --- a/ext/ldap/tests/ldap_search_paged_result_controls.phpt +++ b/ext/ldap/tests/ldap_search_paged_result_controls.phpt @@ -19,16 +19,15 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(cn=user*)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]), - ldap_get_entries($link, $result), - ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), - $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 2]]]), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + $result = ldap_search($link, $dn, $filter, array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [['oid' => LDAP_CONTROL_PAGEDRESULTS, 'value' => ['size' => 20, 'cookie' => $controls[LDAP_CONTROL_PAGEDRESULTS]['value']['cookie']]]]), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -96,4 +95,3 @@ array(2) { string(%d) "cn=userC,cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_sort_controls.phpt b/ext/ldap/tests/ldap_search_sort_controls.phpt index 16504a6997..f55faf4930 100644 --- a/ext/ldap/tests/ldap_search_sort_controls.phpt +++ b/ext/ldap/tests/ldap_search_sort_controls.phpt @@ -19,58 +19,57 @@ insert_dummy_data($link, $base); /* First test with only SORT control */ var_dump( - $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [ - [ - 'oid' => LDAP_CONTROL_SORTREQUEST, - 'iscritical' => TRUE, - 'value' => [ - ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] - ] - ] - ] - ), - ldap_get_entries($link, $result), - ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), - $errcode, - $errmsg, - $controls + $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [ + [ + 'oid' => LDAP_CONTROL_SORTREQUEST, + 'iscritical' => TRUE, + 'value' => [ + ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] + ] + ] + ] + ), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + $errcode, + $errmsg, + $controls ); /* Then with VLV control */ var_dump( - $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, - [ - [ - 'oid' => LDAP_CONTROL_SORTREQUEST, - 'iscritical' => TRUE, - 'value' => [ - ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] - ] - ], - [ - 'oid' => LDAP_CONTROL_VLVREQUEST, - 'iscritical' => TRUE, - 'value' => [ - 'before' => 0, // Return 0 entry before target - 'after' => 1, // Return 1 entry after target - 'offset' => 2, // Target entry is the second one - 'count' => 0, // We have no idea how many entries there are - ] - ] - ] - ), - ldap_get_entries($link, $result), - ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), - array_keys($controls), - $controls[LDAP_CONTROL_SORTRESPONSE], - $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'], - $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'], - $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'], - bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context']) + $result = ldap_search($link, $base, '(cn=*)', array('cn'), 0, 0, 0, LDAP_DEREF_NEVER, + [ + [ + 'oid' => LDAP_CONTROL_SORTREQUEST, + 'iscritical' => TRUE, + 'value' => [ + ['attr' => 'cn', 'oid' => '2.5.13.3' /* caseIgnoreOrderingMatch */, 'reverse' => TRUE] + ] + ], + [ + 'oid' => LDAP_CONTROL_VLVREQUEST, + 'iscritical' => TRUE, + 'value' => [ + 'before' => 0, // Return 0 entry before target + 'after' => 1, // Return 1 entry after target + 'offset' => 2, // Target entry is the second one + 'count' => 0, // We have no idea how many entries there are + ] + ] + ] + ), + ldap_get_entries($link, $result), + ldap_parse_result($link, $result, $errcode , $matcheddn , $errmsg , $referrals, $controls), + array_keys($controls), + $controls[LDAP_CONTROL_SORTRESPONSE], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['target'], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['count'], + $controls[LDAP_CONTROL_VLVRESPONSE]['value']['errcode'], + bin2hex($controls[LDAP_CONTROL_VLVRESPONSE]['value']['context']) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -204,4 +203,3 @@ int(2) int(3) int(0) string(%d) "%s" -===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation1.phpt b/ext/ldap/tests/ldap_search_variation1.phpt index 766efa7598..88eb79aa77 100644 --- a/ext/ldap/tests/ldap_search_variation1.phpt +++ b/ext/ldap/tests/ldap_search_variation1.phpt @@ -19,11 +19,10 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(dc=*)"; var_dump( - $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')), - ldap_get_entries($link, $result) + $result = ldap_search($link, "o=test,$base", "(o=*)", array('o')), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -53,4 +52,3 @@ array(2) { string(%d) "o=test,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation2.phpt b/ext/ldap/tests/ldap_search_variation2.phpt index f2ad3a6929..8b130aaa08 100644 --- a/ext/ldap/tests/ldap_search_variation2.phpt +++ b/ext/ldap/tests/ldap_search_variation2.phpt @@ -17,11 +17,10 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); insert_dummy_data($link, $base); var_dump( - $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1), - ldap_get_entries($link, $result) + $result = ldap_search($link, "$base", "(objectclass=person)", array('sn'), 1), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -77,4 +76,3 @@ array(4) { string(%d) "cn=userC,cn=userB,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation3.phpt b/ext/ldap/tests/ldap_search_variation3.phpt index 12224de24d..d0b6ec5cad 100644 --- a/ext/ldap/tests/ldap_search_variation3.phpt +++ b/ext/ldap/tests/ldap_search_variation3.phpt @@ -19,16 +19,15 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 3), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -105,4 +104,3 @@ array(2) { string(%d) "cn=userA,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation4.phpt b/ext/ldap/tests/ldap_search_variation4.phpt index ce164763b9..694840b397 100644 --- a/ext/ldap/tests/ldap_search_variation4.phpt +++ b/ext/ldap/tests/ldap_search_variation4.phpt @@ -19,11 +19,10 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -52,4 +51,3 @@ array(2) { string(%d) "cn=userA,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation5.phpt b/ext/ldap/tests/ldap_search_variation5.phpt index de4d405090..211df9a128 100644 --- a/ext/ldap/tests/ldap_search_variation5.phpt +++ b/ext/ldap/tests/ldap_search_variation5.phpt @@ -19,19 +19,18 @@ insert_dummy_data($link, $base); $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_SEARCHING), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_FINDING), + ldap_get_entries($link, $result) ); var_dump( - $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS), - ldap_get_entries($link, $result) + $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 3, LDAP_DEREF_ALWAYS), + ldap_get_entries($link, $result) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -102,4 +101,3 @@ array(2) { string(%d) "cn=userA,%s" } } -===DONE=== diff --git a/ext/ldap/tests/ldap_search_variation6.phpt b/ext/ldap/tests/ldap_search_variation6.phpt index a9202967b4..6451c2930b 100644 --- a/ext/ldap/tests/ldap_search_variation6.phpt +++ b/ext/ldap/tests/ldap_search_variation6.phpt @@ -20,22 +20,21 @@ $dn = "$base"; $filter = "(objectclass=person)"; var_dump( - $result = ldap_search(array($link, $link), $dn, $filter), - $result0 = ldap_get_entries($link, $result[0]), - ldap_get_entries($link, $result[1]) === $result0 + $result = ldap_search(array($link, $link), $dn, $filter), + $result0 = ldap_get_entries($link, $result[0]), + ldap_get_entries($link, $result[1]) === $result0 ); var_dump( - $result = ldap_search(array($link, $link), "", $filter), - ldap_get_entries($link, $result[0]), - ldap_get_entries($link, $result[1]) + $result = ldap_search(array($link, $link), "", $filter), + ldap_get_entries($link, $result[0]), + ldap_get_entries($link, $result[1]) ); var_dump( - $result = ldap_search(array($link, $link), "", array($filter, $filter)), - ldap_get_entries($link, $result[0]), - ldap_get_entries($link, $result[1]) + $result = ldap_search(array($link, $link), "", array($filter, $filter)), + ldap_get_entries($link, $result[0]), + ldap_get_entries($link, $result[1]) ); ?> -===DONE=== --CLEAN-- <?php include "connect.inc"; @@ -239,4 +238,3 @@ array(1) { ["count"]=> int(0) } -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_basic.phpt b/ext/ldap/tests/ldap_set_option_basic.phpt index de25e59c21..161f2b5d43 100644 --- a/ext/ldap/tests/ldap_set_option_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_basic.phpt @@ -16,8 +16,6 @@ var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version)); ldap_get_option($link, LDAP_OPT_PROTOCOL_VERSION, $option); var_dump($option); ?> -===DONE=== --EXPECT-- bool(true) int(3) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt b/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt index ff93c9de00..945216d1c0 100644 --- a/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_cafiles_basic.phpt @@ -10,21 +10,20 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_CACERTDIR, - LDAP_OPT_X_TLS_CACERTFILE, - LDAP_OPT_X_TLS_CERTFILE, - LDAP_OPT_X_TLS_KEYFILE, - LDAP_OPT_X_TLS_CRLFILE, - LDAP_OPT_X_TLS_DHFILE, + LDAP_OPT_X_TLS_CACERTDIR, + LDAP_OPT_X_TLS_CACERTFILE, + LDAP_OPT_X_TLS_CERTFILE, + LDAP_OPT_X_TLS_KEYFILE, + LDAP_OPT_X_TLS_CRLFILE, + LDAP_OPT_X_TLS_DHFILE, ] as $option) { - $result = ldap_set_option($link, $option, '/foo/bar'); - var_dump($result); + $result = ldap_set_option($link, $option, '/foo/bar'); + var_dump($result); - ldap_get_option($link, $option, $optionval); - var_dump($optionval); + ldap_get_option($link, $option, $optionval); + var_dump($optionval); } ?> -===DONE=== --EXPECT-- bool(true) string(8) "/foo/bar" @@ -38,4 +37,3 @@ bool(true) string(8) "/foo/bar" bool(true) string(8) "/foo/bar" -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt b/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt index 9b47a826e5..f80da7c2dd 100644 --- a/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_ciphersuite_basic.phpt @@ -15,8 +15,6 @@ var_dump($result); ldap_get_option($link, LDAP_OPT_X_TLS_CIPHER_SUITE, $optionval); var_dump($optionval); ?> -===DONE=== --EXPECT-- bool(true) string(4) "3DES" -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt b/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt index a9aeec0a7b..eff51c785e 100644 --- a/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_crlcheck_basic.phpt @@ -18,18 +18,17 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_CRL_NONE, - LDAP_OPT_X_TLS_CRL_PEER, - LDAP_OPT_X_TLS_CRL_ALL, + LDAP_OPT_X_TLS_CRL_NONE, + LDAP_OPT_X_TLS_CRL_PEER, + LDAP_OPT_X_TLS_CRL_ALL, ] as $option) { - $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, $option); - var_dump($result); + $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, $option); + var_dump($result); - ldap_get_option($link, LDAP_OPT_X_TLS_CRLCHECK, $optionval); - var_dump($optionval); + ldap_get_option($link, LDAP_OPT_X_TLS_CRLCHECK, $optionval); + var_dump($optionval); } ?> -===DONE=== --EXPECT-- bool(true) int(0) @@ -37,4 +36,3 @@ bool(true) int(1) bool(true) int(2) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt b/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt index ea5318344a..053ba41c61 100644 --- a/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt +++ b/ext/ldap/tests/ldap_set_option_crlcheck_error.phpt @@ -11,7 +11,5 @@ $link = ldap_connect($host, $port); $result = ldap_set_option($link, LDAP_OPT_X_TLS_CRLCHECK, 9001); var_dump($result); ?> -===DONE=== --EXPECT-- bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_error.phpt b/ext/ldap/tests/ldap_set_option_error.phpt index 3ea49cbc7e..5ef4c0b86b 100644 --- a/ext/ldap/tests/ldap_set_option_error.phpt +++ b/ext/ldap/tests/ldap_set_option_error.phpt @@ -11,49 +11,29 @@ require "connect.inc"; $link = ldap_connect($host, $port); $controls = array( - array( - array("xid" => "1.2.752.58.10.1", "iscritical" => true), - array("xid" => "1.2.752.58.1.10", "value" => "magic"), - ), - array( - array("oid" => "1.2.752.58.10.1", "iscritical" => true), - array("oid" => "1.2.752.58.1.10", "value" => "magic"), - "weird" - ), - "notanarray" + array( + array("xid" => "1.2.752.58.10.1", "iscritical" => true), + array("xid" => "1.2.752.58.1.10", "value" => "magic"), + ), + array( + array("oid" => "1.2.752.58.10.1", "iscritical" => true), + array("oid" => "1.2.752.58.1.10", "value" => "magic"), + "weird" + ), + "notanarray" ); -// Too few parameters -var_dump(ldap_set_option()); -var_dump(ldap_set_option($link)); -var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION)); - -// Too many parameters -var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3, "Additional data")); - var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 10)); foreach ($controls as $control) - var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control)); + var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control)); var_dump(ldap_set_option($link, 999999, 999999)); ?> -===DONE=== --EXPECTF-- -Warning: ldap_set_option() expects exactly 3 parameters, 0 given in %s on line %d -NULL - -Warning: ldap_set_option() expects exactly 3 parameters, 1 given in %s on line %d -NULL - -Warning: ldap_set_option() expects exactly 3 parameters, 2 given in %s on line %d -NULL - -Warning: ldap_set_option() expects exactly 3 parameters, 4 given in %s on line %d -NULL bool(false) -Warning: ldap_set_option(): Control must have an oid key in %s on line %d +Warning: ldap_set_option(): Control must have an "oid" key in %s on line %d bool(false) Warning: ldap_set_option(): The array value must contain only arrays, where each array is a control in %s on line %d @@ -62,4 +42,3 @@ bool(false) Warning: ldap_set_option(): Expected array value for this option in %s on line %d bool(false) bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt b/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt index 211644b444..f00e885ebe 100644 --- a/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_keepalive_basic.phpt @@ -10,18 +10,17 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_KEEPALIVE_IDLE, - LDAP_OPT_X_KEEPALIVE_PROBES, - LDAP_OPT_X_KEEPALIVE_INTERVAL, + LDAP_OPT_X_KEEPALIVE_IDLE, + LDAP_OPT_X_KEEPALIVE_PROBES, + LDAP_OPT_X_KEEPALIVE_INTERVAL, ] as $option) { - $result = ldap_set_option($link, $option, 5); - var_dump($result); + $result = ldap_set_option($link, $option, 5); + var_dump($result); - ldap_get_option($link, $option, $optionval); - var_dump($optionval); + ldap_get_option($link, $option, $optionval); + var_dump($optionval); } ?> -===DONE=== --EXPECT-- bool(true) int(5) @@ -29,4 +28,3 @@ bool(true) int(5) bool(true) int(5) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt b/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt index a8d23b9592..d087dbf88c 100644 --- a/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_reqcert_basic.phpt @@ -10,20 +10,19 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_NEVER, - LDAP_OPT_X_TLS_HARD, - LDAP_OPT_X_TLS_DEMAND, - LDAP_OPT_X_TLS_ALLOW, - LDAP_OPT_X_TLS_TRY, + LDAP_OPT_X_TLS_NEVER, + LDAP_OPT_X_TLS_HARD, + LDAP_OPT_X_TLS_DEMAND, + LDAP_OPT_X_TLS_ALLOW, + LDAP_OPT_X_TLS_TRY, ] as $option) { - $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option); - var_dump($result); + $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $option); + var_dump($result); - ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval); - var_dump($optionval); + ldap_get_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, $optionval); + var_dump($optionval); } ?> -===DONE=== --EXPECT-- bool(true) int(0) @@ -35,4 +34,3 @@ bool(true) int(3) bool(true) int(4) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_reqcert_error.phpt b/ext/ldap/tests/ldap_set_option_reqcert_error.phpt index b59879b97a..b23d445955 100644 --- a/ext/ldap/tests/ldap_set_option_reqcert_error.phpt +++ b/ext/ldap/tests/ldap_set_option_reqcert_error.phpt @@ -11,7 +11,5 @@ $link = ldap_connect($host, $port); $result = ldap_set_option($link, LDAP_OPT_X_TLS_REQUIRE_CERT, 9001); var_dump($result); ?> -===DONE=== --EXPECT-- bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt b/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt index 81360d0759..782ea24992 100644 --- a/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt +++ b/ext/ldap/tests/ldap_set_option_tls_protocol_min_basic.phpt @@ -10,20 +10,19 @@ require "connect.inc"; $link = ldap_connect($host, $port); foreach([ - LDAP_OPT_X_TLS_PROTOCOL_SSL2, - LDAP_OPT_X_TLS_PROTOCOL_SSL3, - LDAP_OPT_X_TLS_PROTOCOL_TLS1_0, - LDAP_OPT_X_TLS_PROTOCOL_TLS1_1, - LDAP_OPT_X_TLS_PROTOCOL_TLS1_2, + LDAP_OPT_X_TLS_PROTOCOL_SSL2, + LDAP_OPT_X_TLS_PROTOCOL_SSL3, + LDAP_OPT_X_TLS_PROTOCOL_TLS1_0, + LDAP_OPT_X_TLS_PROTOCOL_TLS1_1, + LDAP_OPT_X_TLS_PROTOCOL_TLS1_2, ] as $option) { - $result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option); - var_dump($result); + $result = ldap_set_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $option); + var_dump($result); - ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval); - var_dump($optionval); + ldap_get_option($link, LDAP_OPT_X_TLS_PROTOCOL_MIN, $optionval); + var_dump($optionval); } ?> -===DONE=== --EXPECT-- bool(true) int(512) @@ -35,4 +34,3 @@ bool(true) int(770) bool(true) int(771) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_option_variation.phpt b/ext/ldap/tests/ldap_set_option_variation.phpt index 4c0a138552..4f1e8626d7 100644 --- a/ext/ldap/tests/ldap_set_option_variation.phpt +++ b/ext/ldap/tests/ldap_set_option_variation.phpt @@ -13,55 +13,54 @@ $link = ldap_connect($host, $port); $option = null; $controls = array( - array("oid" => "1.2.752.58.10.1", "iscritical" => true), - array("oid" => "1.2.752.58.1.10", "value" => "magic"), + array("oid" => "1.2.752.58.10.1", "iscritical" => true), + array("oid" => "1.2.752.58.1.10", "value" => "magic"), ); var_dump(ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS)); ldap_get_option($link, LDAP_OPT_DEREF, $option); var_dump( - $option === LDAP_DEREF_ALWAYS, - ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123) + $option === LDAP_DEREF_ALWAYS, + ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123) ); ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33) + $option, + ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33) ); ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44) + $option, + ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44) ); ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_REFERRALS, true) + $option, + ldap_set_option($link, LDAP_OPT_REFERRALS, true) ); ldap_get_option($link, LDAP_OPT_REFERRALS, $option); var_dump( - (bool) $option, - ldap_set_option($link, LDAP_OPT_RESTART, false) + (bool) $option, + ldap_set_option($link, LDAP_OPT_RESTART, false) ); ldap_get_option($link, LDAP_OPT_RESTART, $option); var_dump( - (bool) $option, - ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls) + (bool) $option, + ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls) ); ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls) + $option, + ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls) ); ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option); var_dump( - $option, - ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com") + $option, + ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com") ); ldap_get_option($link, LDAP_OPT_MATCHED_DN, $option); var_dump($option); ?> -===DONE=== --EXPECT-- bool(true) bool(true) @@ -119,4 +118,3 @@ array(2) { } bool(true) string(14) "dc=test,dc=com" -===DONE=== diff --git a/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt b/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt index 428b8d8f02..5c211fc298 100644 --- a/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt +++ b/ext/ldap/tests/ldap_set_rebind_proc_basic.phpt @@ -25,10 +25,8 @@ function rebind_proc ($ds, $ldap_url) { $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump(ldap_set_rebind_proc($link, "rebind_proc")); -var_dump(ldap_set_rebind_proc($link, "")); +var_dump(ldap_set_rebind_proc($link, null)); ?> -===DONE=== --EXPECT-- bool(true) bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt index c8c7985826..c12989b15f 100644 --- a/ext/ldap/tests/ldap_set_rebind_proc_error.phpt +++ b/ext/ldap/tests/ldap_set_rebind_proc_error.phpt @@ -10,7 +10,7 @@ Patrick Allaert <patrickallaert@php.net> die("skip ldap_set_rebind_proc() does not exist"); } require "connect.inc"; - $link = fsockopen($host, $port); + $link = @fsockopen($host, $port); if (!$link) { die("skip no server listening"); } @@ -33,18 +33,11 @@ function rebind_proc ($ds, $ldap_url) { } $link = ldap_connect($host, $port); -var_dump(ldap_set_rebind_proc($link)); -var_dump(ldap_set_rebind_proc($link, "rebind_proc", "Additional data")); -var_dump(ldap_set_rebind_proc($link, "rebind_proc_inexistent")); +try { + $result = ldap_set_rebind_proc($link, "rebind_proc_inexistent"); +} catch(\TypeError $error) { + echo $error->getMessage(), "\n"; +} ?> -===DONE=== --EXPECTF-- -Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 1 given in %s on line %d -bool(false) - -Warning: ldap_set_rebind_proc() expects exactly 2 parameters, 3 given in %s on line %d -bool(false) - -Warning: ldap_set_rebind_proc(): Two arguments expected for 'rebind_proc_inexistent' to be a valid callback in %s on line %d -bool(false) -===DONE=== +ldap_set_rebind_proc(): Argument #2 ($callback) must be a valid callback or null, string given diff --git a/ext/ldap/tests/ldap_sort_basic.phpt b/ext/ldap/tests/ldap_sort_basic.phpt deleted file mode 100644 index e14381f8c7..0000000000 --- a/ext/ldap/tests/ldap_sort_basic.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -ldap_sort() - Basic ldap_sort test ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php require_once('skipifbindfailure.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link, $base); -ldap_add($link, "cn=userC,$base", array( - "objectclass" => "person", - "cn" => "userC", - "sn" => "zzz", - "userPassword" => "oops", - "description" => "a user", -)); -ldap_add($link, "cn=userD,$base", array( - "objectclass" => "person", - "cn" => "userD", - "sn" => "aaa", - "userPassword" => "oops", - "description" => "another user", -)); -ldap_add($link, "cn=userE,$base", array( - "objectclass" => "person", - "cn" => "userE", - "sn" => "a", - "userPassword" => "oops", - "description" => "yet another user", -)); -$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description")); -var_dump( - ldap_sort($link, $result, "sn"), - ldap_get_entries($link, $result) -); -?> -===DONE=== ---CLEAN-- -<?php -include "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "cn=userC,$base"); -ldap_delete($link, "cn=userD,$base"); -ldap_delete($link, "cn=userE,$base"); -remove_dummy_data($link, $base); -?> ---EXPECTF-- -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d -bool(true) -array(7) { - ["count"]=> - int(6) - [0]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(1) "a" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(16) "yet another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userE,%s" - } - [1]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "aaa" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(12) "another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userD,%s" - } - [2]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN1" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user A" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userA,%s" - } - [3]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN2" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user B" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userB,%s" - } - [4]=> - array(4) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN3" - } - [0]=> - string(2) "sn" - ["count"]=> - int(1) - ["dn"]=> - string(%d) "cn=userC,cn=userB,%s" - } - [5]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "zzz" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "a user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userC,%s" - } -} -===DONE=== diff --git a/ext/ldap/tests/ldap_sort_error.phpt b/ext/ldap/tests/ldap_sort_error.phpt deleted file mode 100644 index c41b56ab51..0000000000 --- a/ext/ldap/tests/ldap_sort_error.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -ldap_sort() - Testing ldap_sort() that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -var_dump(ldap_sort($link)); -var_dump(ldap_sort($link, $link)); -var_dump(ldap_sort($link, $link, $link, $link)); -var_dump(ldap_sort($link, $link, $link)); -var_dump(ldap_sort($link, $link, "sn")); -?> -===DONE=== ---EXPECTF-- -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects exactly 3 parameters, 1 given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects exactly 3 parameters, 2 given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects exactly 3 parameters, 4 given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort() expects parameter 3 to be string, resource given in %s on line %d -bool(false) - -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d - -Warning: ldap_sort(): Supplied resource is not a valid ldap result resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_sort_variation.phpt b/ext/ldap/tests/ldap_sort_variation.phpt deleted file mode 100644 index bb121b63cb..0000000000 --- a/ext/ldap/tests/ldap_sort_variation.phpt +++ /dev/null @@ -1,201 +0,0 @@ ---TEST-- -ldap_sort() - Basic ldap_sort test ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php require_once('skipifbindfailure.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -insert_dummy_data($link, $base); -ldap_add($link, "cn=userC,$base", array( - "objectclass" => "person", - "cn" => "userC", - "sn" => "zzz", - "userPassword" => "oops", - "description" => "a user", -)); -ldap_add($link, "cn=userD,$base", array( - "objectclass" => "person", - "cn" => "userD", - "sn" => "aaa", - "userPassword" => "oops", - "description" => "another user", -)); -ldap_add($link, "cn=userE,$base", array( - "objectclass" => "person", - "cn" => "userE", - "sn" => "a", - "userPassword" => "oops", - "description" => "yet another user", -)); -$result = ldap_search($link, "$base", "(objectclass=person)", array("sn", "description")); -var_dump( - ldap_sort($link, $result, "description"), - ldap_get_entries($link, $result) -); -?> -===DONE=== ---CLEAN-- -<?php -include "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); -ldap_delete($link, "cn=userC,$base"); -ldap_delete($link, "cn=userD,$base"); -ldap_delete($link, "cn=userE,$base"); -remove_dummy_data($link, $base); -?> ---EXPECTF-- -Deprecated: Function ldap_sort() is deprecated in %s.php on line %d -bool(true) -array(7) { - ["count"]=> - int(6) - [0]=> - array(4) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN3" - } - [0]=> - string(2) "sn" - ["count"]=> - int(1) - ["dn"]=> - string(%d) "cn=userC,cn=userB,%s" - } - [1]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "zzz" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "a user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userC,%s" - } - [2]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(3) "aaa" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(12) "another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userD,%s" - } - [3]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN1" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user A" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userA,%s" - } - [4]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(7) "testSN2" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(6) "user B" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userB,%s" - } - [5]=> - array(6) { - ["sn"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(1) "a" - } - [0]=> - string(2) "sn" - ["description"]=> - array(2) { - ["count"]=> - int(1) - [0]=> - string(16) "yet another user" - } - [1]=> - string(11) "description" - ["count"]=> - int(2) - ["dn"]=> - string(%d) "cn=userE,%s" - } -} -===DONE=== diff --git a/ext/ldap/tests/ldap_start_tls_basic.phpt b/ext/ldap/tests/ldap_start_tls_basic.phpt index cdb50fd6c9..a9e3c6c97c 100644 --- a/ext/ldap/tests/ldap_start_tls_basic.phpt +++ b/ext/ldap/tests/ldap_start_tls_basic.phpt @@ -14,7 +14,5 @@ $link = ldap_connect($host, $port); ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); var_dump(ldap_start_tls($link)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_start_tls_error.phpt b/ext/ldap/tests/ldap_start_tls_error.phpt deleted file mode 100644 index 686f5331a8..0000000000 --- a/ext/ldap/tests/ldap_start_tls_error.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -ldap_start_tls() - Binding that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php require_once('skipifbindfailure.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect($host, $port); -ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - -// Invalid parameter count -var_dump(ldap_start_tls()); -var_dump(ldap_start_tls($link, $link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_start_tls() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: ldap_start_tls() expects exactly 1 parameter, 2 given in %s on line %d -NULL -===DONE=== diff --git a/ext/ldap/tests/ldap_unbind_basic.phpt b/ext/ldap/tests/ldap_unbind_basic.phpt index addfac5597..622d215546 100644 --- a/ext/ldap/tests/ldap_unbind_basic.phpt +++ b/ext/ldap/tests/ldap_unbind_basic.phpt @@ -14,7 +14,5 @@ $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); var_dump(ldap_unbind($link)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/ldap_unbind_error.phpt b/ext/ldap/tests/ldap_unbind_error.phpt deleted file mode 100644 index 85e586eb6f..0000000000 --- a/ext/ldap/tests/ldap_unbind_error.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -ldap_unbind() - ldap_unbind() operations that should fail ---CREDITS-- -Patrick Allaert <patrickallaert@php.net> -# Belgian PHP Testfest 2009 ---SKIPIF-- -<?php require_once('skipif.inc'); ?> -<?php require_once('skipifbindfailure.inc'); ?> ---FILE-- -<?php -require "connect.inc"; - -$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); - -// Too few parameters -var_dump(ldap_unbind()); - -// Too many parameters -var_dump(ldap_unbind($link, "Additional data")); - -// Bad parameter -var_dump(ldap_unbind("string")); - -// unbind twice -var_dump(ldap_unbind($link)); -var_dump(ldap_unbind($link)); -?> -===DONE=== ---EXPECTF-- -Warning: ldap_unbind() expects exactly 1 parameter, 0 given in %s on line %d -bool(false) - -Warning: ldap_unbind() expects exactly 1 parameter, 2 given in %s on line %d -bool(false) - -Warning: ldap_unbind() expects parameter 1 to be resource, string given in %s on line %d -bool(false) -bool(true) - -Warning: ldap_unbind(): supplied resource is not a valid ldap link resource in %s on line %d -bool(false) -===DONE=== diff --git a/ext/ldap/tests/ldap_unbind_variation.phpt b/ext/ldap/tests/ldap_unbind_variation.phpt index 60edb03b68..0c933543eb 100644 --- a/ext/ldap/tests/ldap_unbind_variation.phpt +++ b/ext/ldap/tests/ldap_unbind_variation.phpt @@ -11,16 +11,16 @@ Patrick Allaert <patrickallaert@php.net> require "connect.inc"; function rebind_proc ($ds, $ldap_url) { - global $user; - global $passwd; - global $protocol_version; + global $user; + global $passwd; + global $protocol_version; - // required by most modern LDAP servers, use LDAPv3 - ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + // required by most modern LDAP servers, use LDAPv3 + ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - if (!ldap_bind($a, $user, $passwd)) { - print "Cannot bind"; - } + if (!ldap_bind($a, $user, $passwd)) { + print "Cannot bind"; + } } $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); @@ -28,7 +28,5 @@ ldap_set_rebind_proc($link, "rebind_proc"); var_dump(ldap_unbind($link)); ?> -===DONE=== --EXPECT-- bool(true) -===DONE=== diff --git a/ext/ldap/tests/skipif.inc b/ext/ldap/tests/skipif.inc index d3494284b0..dc016787da 100644 --- a/ext/ldap/tests/skipif.inc +++ b/ext/ldap/tests/skipif.inc @@ -1,5 +1,5 @@ <?php if (!extension_loaded('ldap')){ - die('skip ldap extension not available'); + die('skip ldap extension not available'); } ?> diff --git a/ext/ldap/tests/skipifbindfailure.inc b/ext/ldap/tests/skipifbindfailure.inc index f79bb9d690..8f66c6cb96 100644 --- a/ext/ldap/tests/skipifbindfailure.inc +++ b/ext/ldap/tests/skipifbindfailure.inc @@ -3,11 +3,11 @@ require_once 'connect.inc'; if ($skip_on_bind_failure) { - $link = ldap_connect($host, $port); - ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); - if (!@ldap_bind($link, $user, $passwd)) - die(sprintf("skip Can't bind to LDAP Server - [%d] %s", ldap_errno($link), ldap_error($link))); + $link = ldap_connect($host, $port); + ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); + if (!@ldap_bind($link, $user, $passwd)) + die(sprintf("skip Can't bind to LDAP Server - [%d] %s", ldap_errno($link), ldap_error($link))); - ldap_unbind($link); + ldap_unbind($link); } ?> diff --git a/ext/ldap/tests/skipifcontrol.inc b/ext/ldap/tests/skipifcontrol.inc index ae551d6add..ff690068ae 100644 --- a/ext/ldap/tests/skipifcontrol.inc +++ b/ext/ldap/tests/skipifcontrol.inc @@ -3,11 +3,11 @@ require_once 'connect.inc'; function skipifunsupportedcontrol($oid) { - global $host, $port, $user, $passwd, $protocol_version, $base; - $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); - $result = ldap_read($link, '', '(objectClass=*)', ['supportedControl']); - if (!in_array($oid, ldap_get_entries($link, $result)[0]['supportedcontrol'])) { - die(sprintf("skip Unsupported control %s", $oid)); - } + global $host, $port, $user, $passwd, $protocol_version, $base; + $link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); + $result = ldap_read($link, '', '(objectClass=*)', ['supportedControl']); + if (!in_array($oid, ldap_get_entries($link, $result)[0]['supportedcontrol'])) { + die(sprintf("skip Unsupported control %s", $oid)); + } } ?> |