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