1--TEST-- 2ldap_search() - operation that should fail 3--CREDITS-- 4Davide Mendolia <idaf1er@gmail.com> 5Belgian PHP Testfest 2009 6--SKIPIF-- 7<?php require_once __DIR__ .'/skipif.inc'; ?> 8<?php require_once __DIR__ .'/skipifbindfailure.inc'; ?> 9--FILE-- 10<?php 11include "connect.inc"; 12 13$link = ldap_connect($host, $port); 14 15$dn = "dc=not-found,$base"; 16$filter = "(dc=*)"; 17 18$result = ldap_search($link, $dn, $filter); 19var_dump($result); 20 21$result = ldap_search($link, $dn, $filter, array(1 => 'top')); 22var_dump($result); 23 24try { 25 ldap_search(array(), $dn, $filter, array('top')); 26} catch (ValueError $exception) { 27 echo $exception->getMessage() . "\n"; 28} 29 30try { 31 ldap_search(array($link, $link), array($dn), $filter, array('top')); 32} catch (ValueError $exception) { 33 echo $exception->getMessage() . "\n"; 34} 35 36try { 37 ldap_search(array($link, $link), $dn, array($filter), array('top')); 38} catch (ValueError $exception) { 39 echo $exception->getMessage() . "\n"; 40} 41 42try { 43 ldap_search($link, [], []); 44} catch (TypeError $exception) { 45 echo $exception->getMessage() . "\n"; 46} 47 48try { 49 ldap_search($link, "", []); 50} catch (TypeError $exception) { 51 echo $exception->getMessage() . "\n"; 52} 53 54?> 55--EXPECTF-- 56Warning: ldap_search(): Search: No such object in %s on line %d 57bool(false) 58 59Warning: ldap_search(): Array initialization wrong in %s on line %d 60bool(false) 61ldap_search(): Argument #1 ($ldap) cannot be empty 62ldap_search(): Argument #2 ($base) must have the same number of elements as the links array 63ldap_search(): Argument #3 ($filter) must have the same number of elements as the links array 64ldap_search(): Argument #2 ($base) must be of type string when argument #1 ($ldap) is a resource 65ldap_search(): Argument #3 ($filter) must be of type string when argument #1 ($ldap) is a resource 66