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