1--TEST-- 2ldap_set_option() - ldap_set_option() operation that should fail 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5# Belgian PHP Testfest 2009 6--SKIPIF-- 7<?php require_once('skipif.inc'); ?> 8--FILE-- 9<?php 10require "connect.inc"; 11 12$link = ldap_connect($host, $port); 13$controls = array( 14 array( 15 array("xid" => "1.2.752.58.10.1", "iscritical" => true), 16 array("xid" => "1.2.752.58.1.10", "value" => "magic"), 17 ), 18 array( 19 array("oid" => "1.2.752.58.10.1", "iscritical" => true), 20 array("oid" => "1.2.752.58.1.10", "value" => "magic"), 21 "weird" 22 ), 23 array( 24 ), 25); 26 27// Too few parameters 28var_dump(ldap_set_option()); 29var_dump(ldap_set_option($link)); 30var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION)); 31 32// Too many parameters 33var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 3, "Additional data")); 34 35var_dump(ldap_set_option($link, LDAP_OPT_PROTOCOL_VERSION, 10)); 36 37foreach ($controls as $control) 38 var_dump(ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $control)); 39 40var_dump(ldap_set_option($link, 999999, 999999)); 41?> 42===DONE=== 43--EXPECTF-- 44Warning: ldap_set_option() expects exactly 3 parameters, 0 given in %s on line %d 45NULL 46 47Warning: ldap_set_option() expects exactly 3 parameters, 1 given in %s on line %d 48NULL 49 50Warning: ldap_set_option() expects exactly 3 parameters, 2 given in %s on line %d 51NULL 52 53Warning: ldap_set_option() expects exactly 3 parameters, 4 given in %s on line %d 54NULL 55bool(false) 56 57Warning: ldap_set_option(): Control must have an oid key in %s on line %d 58bool(false) 59 60Warning: ldap_set_option(): The array value must contain only arrays, where each array is a control in %s on line %d 61bool(false) 62 63Warning: ldap_set_option(): Expected non-empty array value for this option in %s on line %d 64bool(false) 65bool(false) 66===DONE=== 67