1--TEST-- 2ldap_modify_batch() - Batch modify operations that should fail 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5Ondřej Hošek <ondra.hosek@gmail.com> 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); 14 15$addGivenName = array( 16 array( 17 "attrib" => "givenName", 18 "modtype" => LDAP_MODIFY_BATCH_ADD, 19 "values" => array("Jack") 20 ) 21); 22 23// DN not found 24var_dump(ldap_modify_batch($link, "cn=not-found,$base", $addGivenName)); 25 26// Invalid DN 27var_dump(ldap_modify_batch($link, "weirdAttribute=val", $addGivenName)); 28 29// prepare 30$entry = array( 31 "objectClass" => array( 32 "top", 33 "dcObject", 34 "organization"), 35 "dc" => "my-domain", 36 "o" => "my-domain", 37); 38 39ldap_add($link, "dc=my-domain,$base", $entry); 40 41// invalid domain 42$mods = array( 43 array( 44 "attrib" => "dc", 45 "modtype" => LDAP_MODIFY_BATCH_REPLACE, 46 "values" => array("Wrong Domain") 47 ) 48); 49 50var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); 51 52// invalid attribute 53$mods = array( 54 array( 55 "attrib" => "weirdAttribute", 56 "modtype" => LDAP_MODIFY_BATCH_ADD, 57 "values" => array("weirdVal", "anotherWeirdval") 58 ) 59); 60 61var_dump(ldap_modify_batch($link, "dc=my-domain,$base", $mods)); 62?> 63--CLEAN-- 64<?php 65require "connect.inc"; 66 67$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 68 69ldap_delete($link, "dc=my-domain,$base"); 70?> 71--EXPECTF-- 72Warning: ldap_modify_batch(): Batch Modify: No such object in %s on line %d 73bool(false) 74 75Warning: ldap_modify_batch(): Batch Modify: Invalid DN syntax in %s on line %d 76bool(false) 77 78Warning: ldap_modify_batch(): Batch Modify: Naming violation in %s on line %d 79bool(false) 80 81Warning: ldap_modify_batch(): Batch Modify: Undefined attribute type in %s on line %d 82bool(false) 83