xref: /PHP-7.1/ext/ldap/tests/ldap_bind_error.phpt (revision 17aa2607)
1--TEST--
2ldap_bind() - Binding that should fail
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8<?php require_once('skipifbindfailure.inc'); ?>
9--FILE--
10<?php
11require "connect.inc";
12
13$link = ldap_connect($host, $port);
14ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, $protocol_version);
15
16// Invalid parameter count
17var_dump(ldap_bind($link, $user, $passwd, null));
18
19// Invalid password
20var_dump(ldap_bind($link, $user, "ThisIsNotCorrect$passwd"));
21
22// Invalid DN syntax
23var_dump(ldap_bind($link, "unexistingProperty=weirdValue,$user", $passwd));
24?>
25===DONE===
26--EXPECTF--
27Warning: ldap_bind() expects at most 3 parameters, 4 given in %s on line %d
28bool(false)
29
30Warning: ldap_bind(): Unable to bind to server: Invalid credentials in %s on line %d
31bool(false)
32
33Warning: ldap_bind(): Unable to bind to server: Invalid DN syntax in %s on line %d
34bool(false)
35===DONE===
36