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, $base);
15ldap_add($link, "cn=userref,$base", array(
16        "objectClass" => array("extensibleObject", "referral"),
17        "cn" => "userref",
18        "ref" => "cn=userA,$base",
19));
20$result = ldap_search($link, "cn=userref,$base", "(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,$base");
36remove_dummy_data($link, $base);
37?>
38--EXPECTF--
39bool(true)
40int(10)
41string(%d) "cn=userref,%s"
42string(0) ""
43array(1) {
44  [0]=>
45  string(%d) "cn=userA,%s"
46}
47===DONE===
48