1--TEST-- 2ldap_next_reference() - Basic ldap_next_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); 14ldap_add($link, "cn=userref,dc=my-domain,dc=com", array( 15 "objectClass" => array("extensibleObject", "referral"), 16 "cn" => "userref", 17 "ref" => "cn=userA,dc=my-domain,dc=com", 18)); 19ldap_add($link, "cn=userref2,dc=my-domain,dc=com", array( 20 "objectClass" => array("extensibleObject", "referral"), 21 "cn" => "userref2", 22 "ref" => "cn=userB,dc=my-domain,dc=com", 23)); 24ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER); 25$result = ldap_search($link, "dc=my-domain,dc=com", "(cn=*)"); 26$ref = ldap_first_reference($link, $result); 27var_dump($ref2 = ldap_next_reference($link, $ref)); 28ldap_parse_reference($link, $ref2, $refs); 29var_dump($refs); 30?> 31===DONE=== 32--CLEAN-- 33<?php 34include "connect.inc"; 35 36$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 37// Referral can only be removed with Manage DSA IT Control 38ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, array(array("oid" => "2.16.840.1.113730.3.4.2"))); 39ldap_delete($link, "cn=userref,dc=my-domain,dc=com"); 40ldap_delete($link, "cn=userref2,dc=my-domain,dc=com"); 41remove_dummy_data($link); 42?> 43--EXPECTF-- 44resource(%d) of type (ldap result entry) 45array(1) { 46 [0]=> 47 string(28) "cn=userB,dc=my-domain,dc=com" 48} 49===DONE=== 50