1--TEST--
2ldap_parse_result() - Basic ldap_parse_result 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
13$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
14insert_dummy_data($link);
15ldap_add($link, "cn=userref,dc=my-domain,dc=com", array(
16        "objectClass" => array("extensibleObject", "referral"),
17        "cn" => "userref",
18        "ref" => "cn=userA,dc=my-domain,dc=com",
19));
20$result = ldap_search($link, "cn=userref,dc=my-domain,dc=com", "(cn=user*)");
21$errcode = $dn = $errmsg = $refs =  null;
22var_dump(
23	ldap_parse_result($link, $result, $errcode, $dn, $errmsg, $refs),
24	$errcode, $dn, $errmsg, $refs
25);
26?>
27===DONE===
28--CLEAN--
29<?php
30include "connect.inc";
31
32$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
33// Referral can only be removed with Manage DSA IT Control
34ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2")));
35ldap_delete($link, "cn=userref,dc=my-domain,dc=com");
36remove_dummy_data($link);
37?>
38--EXPECT--
39bool(true)
40int(10)
41string(30) "cn=userref,dc=my-domain,dc=com"
42string(0) ""
43array(1) {
44  [0]=>
45  string(28) "cn=userA,dc=my-domain,dc=com"
46}
47===DONE===
48