1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/ldap/tests/ldap_search_error.phpt
2024-09-30 11:27:40 +01:00

69 lines
1.8 KiB
PHP

--TEST--
ldap_search() - operation that should fail
--CREDITS--
Davide Mendolia <idaf1er@gmail.com>
Belgian PHP Testfest 2009
--EXTENSIONS--
ldap
--SKIPIF--
<?php require_once __DIR__ .'/skipifbindfailure.inc'; ?>
--FILE--
<?php
include "connect.inc";
$link = ldap_connect($uri);
$dn = "dc=not-found,$base";
$filter = "(dc=*)";
$result = ldap_search($link, $dn, $filter);
var_dump($result);
try {
$result = ldap_search($link, $dn, $filter, array(1 => 'top'));
var_dump($result);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
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";
}
try {
ldap_search($link, [], []);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
try {
ldap_search($link, "", []);
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECTF--
Warning: ldap_search(): Search: No such object in %s on line %d
bool(false)
ldap_search(): Argument #4 ($attributes) must be a list
ldap_search(): Argument #1 ($ldap) must not be empty
ldap_search(): Argument #2 ($base) must be the same size as argument #1
ldap_search(): Argument #3 ($filter) must be the same size as argument #1
ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is an LDAP\Connection instance
ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is an LDAP\Connection instance