1--TEST-- 2ldap_bind_ext() - Basic binding 3--CREDITS-- 4Côme Chilliet <mcmic@php.net> 5--SKIPIF-- 6<?php require_once __DIR__ .'/skipif.inc'; ?> 7<?php require_once __DIR__ .'/skipifbindfailure.inc'; ?> 8<?php 9require_once('skipifcontrol.inc'); 10skipifunsupportedcontrol(LDAP_CONTROL_PASSWORDPOLICYREQUEST); 11?> 12--FILE-- 13<?php 14require "connect.inc"; 15 16$link = ldap_connect($host, $port); 17ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); 18 19var_dump( 20 $result = ldap_bind_ext($link, $user, $passwd), 21 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 22 $errcode, 23 $errmsg, 24 $ctrls, 25 $result = ldap_bind_ext($link, $user, $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), 26 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 27 $errcode, 28 $errmsg, 29 $ctrls 30); 31 32/* Failures */ 33var_dump( 34 $result = ldap_bind_ext($link, $user, "wrongPassword", [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), 35 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 36 $errcode, 37 $errmsg, 38 $ctrls, 39 $result = ldap_bind_ext($link, "unexistingProperty=weirdValue,$user", $passwd, [['oid' => LDAP_CONTROL_PASSWORDPOLICYREQUEST]]), 40 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 41 $errcode, 42 $errmsg, 43 $ctrls 44); 45?> 46===DONE=== 47--EXPECTF-- 48resource(%d) of type (ldap result) 49bool(true) 50int(0) 51string(0) "" 52array(0) { 53} 54resource(%d) of type (ldap result) 55bool(true) 56int(0) 57string(0) "" 58array(0) { 59} 60resource(%d) of type (ldap result) 61bool(true) 62int(49) 63string(0) "" 64array(0) { 65} 66resource(%d) of type (ldap result) 67bool(true) 68int(34) 69string(10) "invalid DN" 70array(0) { 71} 72===DONE=== 73