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