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