1--TEST--
2ldap_parse_reference() - Basic ldap_parse_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_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
21$result = ldap_search($link, "$base", "(cn=*)");
22$ref = ldap_first_reference($link, $result);
23$refs = null;
24var_dump(
25    ldap_parse_reference($link, $ref, $refs),
26    $refs
27);
28?>
29--CLEAN--
30<?php
31include "connect.inc";
32
33$link = ldap_connect_and_bind($uri, $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