1--TEST--
2ldap_next_reference() - Basic ldap_next_reference test
3--CREDITS--
4Patrick Allaert <patrickallaert@php.net>
5# Belgian PHP Testfest 2009
6--EXTENSIONS--
7ldap
8--SKIPIF--
9<?php require_once('skipifbindfailure.inc'); ?>
10--FILE--
11<?php
12require "connect.inc";
13$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
14insert_dummy_data($link, $base);
15ldap_add($link, "cn=userref,$base", array(
16        "objectClass" => array("extensibleObject", "referral"),
17        "cn" => "userref",
18        "ref" => "cn=userA,$base",
19));
20ldap_add($link, "cn=userref2,$base", array(
21        "objectClass" => array("extensibleObject", "referral"),
22        "cn" => "userref2",
23        "ref" => "cn=userB,$base",
24));
25ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
26$result = ldap_search($link, "$base", "(cn=*)");
27$ref = ldap_first_reference($link, $result);
28var_dump($ref2 = ldap_next_reference($link, $ref));
29ldap_parse_reference($link, $ref2, $refs);
30var_dump($refs);
31?>
32--CLEAN--
33<?php
34include "connect.inc";
35
36$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
37// Referral can only be removed with Manage DSA IT Control
38ldap_delete($link, "cn=userref,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]);
39ldap_delete($link, "cn=userref2,$base", [['oid' => LDAP_CONTROL_MANAGEDSAIT, 'iscritical' => TRUE]]);
40remove_dummy_data($link, $base);
41?>
42--EXPECTF--
43object(LDAP\ResultEntry)#%d (0) {
44}
45array(1) {
46  [0]=>
47  string(%d) "cn=userB,%s"
48}
49