2009-07-03 09:20:50 +00:00
|
|
|
--TEST--
|
|
|
|
ldap_search() - operation that should fail
|
|
|
|
--CREDITS--
|
|
|
|
Davide Mendolia <idaf1er@gmail.com>
|
|
|
|
Belgian PHP Testfest 2009
|
2021-06-11 12:49:22 +00:00
|
|
|
--EXTENSIONS--
|
|
|
|
ldap
|
2009-07-03 09:20:50 +00:00
|
|
|
--SKIPIF--
|
2019-03-15 21:55:30 +00:00
|
|
|
<?php require_once __DIR__ .'/skipifbindfailure.inc'; ?>
|
2009-07-03 09:20:50 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
include "connect.inc";
|
|
|
|
|
2023-07-10 09:44:01 +00:00
|
|
|
$link = ldap_connect($uri);
|
2009-07-03 09:20:50 +00:00
|
|
|
|
2015-06-17 11:47:32 +00:00
|
|
|
$dn = "dc=not-found,$base";
|
2009-07-03 09:20:50 +00:00
|
|
|
$filter = "(dc=*)";
|
|
|
|
|
|
|
|
$result = ldap_search($link, $dn, $filter);
|
|
|
|
var_dump($result);
|
|
|
|
|
|
|
|
$result = ldap_search($link, $dn, $filter, array(1 => 'top'));
|
|
|
|
var_dump($result);
|
|
|
|
|
2020-09-03 14:21:36 +00:00
|
|
|
try {
|
|
|
|
ldap_search(array(), $dn, $filter, array('top'));
|
|
|
|
} catch (ValueError $exception) {
|
|
|
|
echo $exception->getMessage() . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
ldap_search(array($link, $link), array($dn), $filter, array('top'));
|
|
|
|
} catch (ValueError $exception) {
|
|
|
|
echo $exception->getMessage() . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
ldap_search(array($link, $link), $dn, array($filter), array('top'));
|
|
|
|
} catch (ValueError $exception) {
|
|
|
|
echo $exception->getMessage() . "\n";
|
|
|
|
}
|
2009-07-03 09:20:50 +00:00
|
|
|
|
2021-03-15 22:07:05 +00:00
|
|
|
try {
|
|
|
|
ldap_search($link, [], []);
|
|
|
|
} catch (TypeError $exception) {
|
|
|
|
echo $exception->getMessage() . "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
ldap_search($link, "", []);
|
|
|
|
} catch (TypeError $exception) {
|
|
|
|
echo $exception->getMessage() . "\n";
|
|
|
|
}
|
|
|
|
|
2009-07-03 09:20:50 +00:00
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
Warning: ldap_search(): Search: No such object in %s on line %d
|
|
|
|
bool(false)
|
|
|
|
|
|
|
|
Warning: ldap_search(): Array initialization wrong in %s on line %d
|
|
|
|
bool(false)
|
2020-09-28 12:52:40 +00:00
|
|
|
ldap_search(): Argument #1 ($ldap) cannot be empty
|
2020-09-17 15:13:48 +00:00
|
|
|
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array
|
2020-09-03 14:21:36 +00:00
|
|
|
ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array
|
2021-03-13 11:11:40 +00:00
|
|
|
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is an LDAP instance
|
|
|
|
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is an LDAP instance
|