Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 71fc6f4

Browse files
committedDec 27, 2024··
test
1 parent fceefe7 commit 71fc6f4

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed
 

‎ext/ldap/tests/gh17280.phpt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
GH-17280 (ldap_search() fails when $attributes array has holes)
3+
--EXTENSIONS--
4+
ldap
5+
--FILE--
6+
<?php
7+
8+
/* We are assuming 3333 is not connectable */
9+
$ldap = ldap_connect('ldap://127.0.0.1:3333');
10+
11+
// Creating an array with a hole in it
12+
$attr = array_unique(['cn', 'uid', 'uid', 'mail']);
13+
var_dump(ldap_search($ldap, 'ou=people,dc=example,dc=com', 'uid=admin', $attr));
14+
15+
?>
16+
--EXPECTF--
17+
Warning: ldap_search(): Search: Can't contact LDAP server in %s on line %d
18+
bool(false)

‎ext/ldap/tests/ldap_add_error.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ try {
4343
ldap_add($link, "dc=my-domain2,dc=com", array(
4444
"objectClass" => array(
4545
0 => "top",
46-
2 => "dcObject",
46+
"x" => "dcObject",
4747
5 => "organization"),
4848
"dc" => "my-domain",
4949
"o" => "my-domain",
@@ -104,7 +104,7 @@ Warning: ldap_add(): Add: Already exists in %s on line %d
104104
bool(false)
105105
string(14) "Already exists"
106106
int(68)
107-
ldap_add(): Argument #3 ($entry) must contain arrays with consecutive integer indices starting from 0
107+
ldap_add(): Argument #3 ($entry) must be an array with numeric keys
108108

109109
Warning: ldap_add(): Add: Undefined attribute type in %s on line %d
110110
bool(false)

‎ext/ldap/tests/ldap_search_error.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $filter = "(dc=*)";
1919
$result = ldap_search($link, $dn, $filter);
2020
var_dump($result);
2121

22-
$result = ldap_search($link, $dn, $filter, array(1 => 'top'));
22+
$result = ldap_search($link, $dn, $filter, array('foo' => 'top'));
2323
var_dump($result);
2424

2525
try {
@@ -57,7 +57,7 @@ try {
5757
Warning: ldap_search(): Search: No such object in %s on line %d
5858
bool(false)
5959

60-
Warning: ldap_search(): Array initialization wrong in %s on line %d
60+
Warning: ldap_search(): Argument #4 ($attributes) must be an array with numeric keys
6161
bool(false)
6262
ldap_search(): Argument #1 ($ldap) cannot be empty
6363
ldap_search(): Argument #2 ($base) must have the same number of elements as the links array

0 commit comments

Comments
 (0)
Please sign in to comment.