--TEST-- Programming errors (Value/Type errors) for ldap_add(_ext)(), ldap_mod_replace(_ext)(), ldap_mod_add(_ext)(), and ldap_mod_del(_ext)() with references --EXTENSIONS-- ldap --FILE-- 'value', 'attribute2' => [ 'value1', 'value2', ], ]; $obj = new stdClass(); $dict_key_value_not_string = [ 'attribute1' => &$obj, 'attribute2' => [ 'value1', 'value2', ], ]; try { var_dump(ldap_add($ldap, $valid_dn, $dict_key_value_not_string)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $empty_list = []; $dict_key_multi_value_empty_list = [ 'attribute1' => 'value', 'attribute2' => &$empty_list, ]; try { var_dump(ldap_add($ldap, $valid_dn, $dict_key_multi_value_empty_list)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $empty_list = []; $dict_key_multi_value_not_list_of_strings = [ 'attribute1' => 'value', 'attribute2' => [ 'value1', &$empty_list, ], ]; try { var_dump(ldap_add($ldap, $valid_dn, $dict_key_multi_value_not_list_of_strings)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } $obj = new stdClass(); $dict_key_multi_value_not_list_of_strings2 = [ 'attribute1' => 'value', 'attribute2' => [ 'value1', &$obj, ], ]; try { var_dump(ldap_add($ldap, $valid_dn, $dict_key_multi_value_not_list_of_strings2)); } catch (Throwable $e) { echo $e::class, ': ', $e->getMessage(), PHP_EOL; } /* We don't check that values have nul bytes as the length of the string is passed to LDAP */ ?> --EXPECT-- Error: Object of class stdClass could not be converted to string ValueError: ldap_add(): Argument #3 ($entry) list of attribute values must not be empty TypeError: LDAP value must be of type string|int|bool, array given TypeError: LDAP value must be of type string|int|bool, stdClass given