1--TEST-- 2ldap_modify_batch() - modification array contains references 3--EXTENSIONS-- 4ldap 5--FILE-- 6<?php 7 8/* We are assuming 3333 is not connectable */ 9$ldap = ldap_connect('ldap://127.0.0.1:3333'); 10$valid_dn = "cn=userA,something"; 11 12$empty_list = []; 13$modification_reference = [ 14 &$empty_list, 15]; 16try { 17 var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_reference)); 18} catch (Throwable $e) { 19 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 20} 21 22$attrib = "attrib\0with\0nul\0byte"; 23$modification_attrib_reference_string = [ 24 [ 25 "attrib" => &$attrib, 26 "modtype" => LDAP_MODIFY_BATCH_ADD, 27 "values" => ["value1"], 28 ], 29]; 30try { 31 var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_attrib_reference_string)); 32} catch (Throwable $e) { 33 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 34} 35 36$modtype = -10; 37$modification_modtype_reference_int = [ 38 [ 39 "attrib" => "attrib1", 40 "modtype" => &$modtype, 41 "values" => ["value1"], 42 ], 43]; 44try { 45 var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_modtype_reference_int)); 46} catch (Throwable $e) { 47 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 48} 49 50 51$values = []; 52$modification_values_reference_array = [ 53 [ 54 "attrib" => "attrib1", 55 "modtype" => LDAP_MODIFY_BATCH_ADD, 56 "values" => &$values, 57 ], 58]; 59try { 60 var_dump(ldap_modify_batch($ldap, $valid_dn, $modification_values_reference_array)); 61} catch (Throwable $e) { 62 echo $e::class, ': ', $e->getMessage(), PHP_EOL; 63} 64 65?> 66--EXPECT-- 67ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) a modification entry must only contain the keys "attrib", "modtype", and "values" 68ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "attrib" must not contain null bytes 69ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "modtype" must be LDAP_MODIFY_BATCH_ADD, LDAP_MODIFY_BATCH_REMOVE, LDAP_MODIFY_BATCH_REPLACE, or LDAP_MODIFY_BATCH_REMOVE_ALL 70ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must not be empty 71