1--TEST--
2ldap_count_references() - Basic ldap_count_references test
3--EXTENSIONS--
4ldap
5--SKIPIF--
6<?php require_once('skipifbindfailure.inc'); ?>
7--FILE--
8<?php
9require "connect.inc";
10$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
11insert_dummy_data($link, $base);
12ldap_add($link, "cn=userref,$base", array(
13        "objectClass" => array("extensibleObject", "referral"),
14        "cn" => "userref",
15        "ref" => "cn=userA,$base",
16));
17ldap_add($link, "cn=userref2,$base", array(
18        "objectClass" => array("extensibleObject", "referral"),
19        "cn" => "userref2",
20        "ref" => "cn=userB,$base",
21));
22ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
23$result = ldap_search($link, "$base", "(cn=*)");
24var_dump(ldap_count_references($link, $result));
25?>
26--CLEAN--
27<?php
28include "connect.inc";
29
30$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
31// Referral can only be removed with Manage DSA IT Control
32ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]);
33ldap_delete($link, "cn=userref2,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]);
34remove_dummy_data($link, $base);
35?>
36--EXPECT--
37int(2)
38