1--TEST-- 2ldap_set_rebind_proc() - Testing ldap_set_rebind_proc() that should fail 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5# Belgian PHP Testfest 2009 6--EXTENSIONS-- 7ldap 8--SKIPIF-- 9<?php 10 if (!function_exists("ldap_set_rebind_proc")) { 11 die("skip ldap_set_rebind_proc() does not exist"); 12 } 13 require "connect.inc"; 14 $link = @fsockopen($host, $port); 15 if (!$link) { 16 die("skip no server listening"); 17 } 18?> 19--FILE-- 20<?php 21require "connect.inc"; 22 23function rebind_proc ($ds, $ldap_url) { 24 global $user; 25 global $passwd; 26 global $protocol_version; 27 28 // required by most modern LDAP servers, use LDAPv3 29 ldap_set_option($a, LDAP_OPT_PROTOCOL_VERSION, $protocol_version); 30 31 if (!ldap_bind($a, $user, $passwd)) { 32 print "Cannot bind"; 33 } 34} 35 36$link = ldap_connect($host, $port); 37try { 38 $result = ldap_set_rebind_proc($link, "rebind_proc_inexistent"); 39} catch(\TypeError $error) { 40 echo $error->getMessage(), "\n"; 41} 42?> 43--EXPECT-- 44ldap_set_rebind_proc(): Argument #2 ($callback) must be a valid callback or null, function "rebind_proc_inexistent" not found or invalid function name 45