1--TEST-- 2ldap_search() bug 48441 - options persists after specifying them in ldap_search 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5--EXTENSIONS-- 6ldap 7--SKIPIF-- 8<?php 9require_once('skipifbindfailure.inc'); 10?> 11--FILE-- 12<?php 13include "connect.inc"; 14 15$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version); 16insert_dummy_data($link, $base); 17 18$dn = "$base"; 19$filter = "(objectclass=person)"; 20 21var_dump( 22 $result = ldap_search($link, $dn, $filter, array('sn')), 23 ldap_get_entries($link, $result) 24); 25var_dump( 26 $result = ldap_search($link, $dn, $filter, array('sn'), 1, 1, 1, LDAP_DEREF_ALWAYS), 27 ldap_get_entries($link, $result) 28); 29var_dump( 30 $result = ldap_search($link, $dn, $filter, array('sn')), 31 ldap_get_entries($link, $result) 32); 33?> 34--CLEAN-- 35<?php 36include "connect.inc"; 37 38$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version); 39remove_dummy_data($link, $base); 40?> 41--EXPECTF-- 42object(LDAP\Result)#%d (0) { 43} 44array(4) { 45 ["count"]=> 46 int(3) 47 [0]=> 48 array(4) { 49 ["sn"]=> 50 array(2) { 51 ["count"]=> 52 int(1) 53 [0]=> 54 string(7) "testSN1" 55 } 56 [0]=> 57 string(2) "sn" 58 ["count"]=> 59 int(1) 60 ["dn"]=> 61 string(%d) "cn=userA,%s" 62 } 63 [1]=> 64 array(4) { 65 ["sn"]=> 66 array(2) { 67 ["count"]=> 68 int(1) 69 [0]=> 70 string(7) "testSN2" 71 } 72 [0]=> 73 string(2) "sn" 74 ["count"]=> 75 int(1) 76 ["dn"]=> 77 string(%d) "cn=userB,%s" 78 } 79 [2]=> 80 array(4) { 81 ["sn"]=> 82 array(2) { 83 ["count"]=> 84 int(1) 85 [0]=> 86 string(7) "testSN3" 87 } 88 [0]=> 89 string(2) "sn" 90 ["count"]=> 91 int(1) 92 ["dn"]=> 93 string(%d) "cn=userC,cn=userB,%s" 94 } 95} 96 97Warning: ldap_search(): Partial search results returned: Sizelimit exceeded in %s on line %d 98object(LDAP\Result)#%d (0) { 99} 100array(2) { 101 ["count"]=> 102 int(1) 103 [0]=> 104 array(4) { 105 ["sn"]=> 106 array(1) { 107 ["count"]=> 108 int(0) 109 } 110 [0]=> 111 string(2) "sn" 112 ["count"]=> 113 int(1) 114 ["dn"]=> 115 string(%d) "cn=userA,%s" 116 } 117} 118object(LDAP\Result)#%d (0) { 119} 120array(4) { 121 ["count"]=> 122 int(3) 123 [0]=> 124 array(4) { 125 ["sn"]=> 126 array(2) { 127 ["count"]=> 128 int(1) 129 [0]=> 130 string(7) "testSN1" 131 } 132 [0]=> 133 string(2) "sn" 134 ["count"]=> 135 int(1) 136 ["dn"]=> 137 string(%d) "cn=userA,%s" 138 } 139 [1]=> 140 array(4) { 141 ["sn"]=> 142 array(2) { 143 ["count"]=> 144 int(1) 145 [0]=> 146 string(7) "testSN2" 147 } 148 [0]=> 149 string(2) "sn" 150 ["count"]=> 151 int(1) 152 ["dn"]=> 153 string(%d) "cn=userB,%s" 154 } 155 [2]=> 156 array(4) { 157 ["sn"]=> 158 array(2) { 159 ["count"]=> 160 int(1) 161 [0]=> 162 string(7) "testSN3" 163 } 164 [0]=> 165 string(2) "sn" 166 ["count"]=> 167 int(1) 168 ["dn"]=> 169 string(%d) "cn=userC,cn=userB,%s" 170 } 171} 172