mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/ldap: Use zend_array_is_list() API to check "values" array
This commit is contained in:
parent
6f50850e76
commit
0a39b48acc
2 changed files with 10 additions and 20 deletions
|
@ -2527,7 +2527,7 @@ PHP_FUNCTION(ldap_modify_batch)
|
|||
zval *fetched;
|
||||
char *dn;
|
||||
size_t dn_len;
|
||||
int i, j, k;
|
||||
int i, j;
|
||||
int num_mods, num_modprops, num_modvals;
|
||||
LDAPMod **ldap_mods;
|
||||
LDAPControl **lserverctrls = NULL;
|
||||
|
@ -2682,27 +2682,17 @@ PHP_FUNCTION(ldap_modify_batch)
|
|||
}
|
||||
|
||||
SEPARATE_ARRAY(modinfo);
|
||||
const HashTable *modification_values = Z_ARRVAL_P(modinfo);
|
||||
/* is the array not empty? */
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(modinfo));
|
||||
num_modvals = zend_hash_num_elements(Z_ARRVAL_P(modinfo));
|
||||
if (num_modvals == 0) {
|
||||
zend_value_error("%s(): Option \"" LDAP_MODIFY_BATCH_VALUES "\" must not be empty", get_active_function_name());
|
||||
uint32_t num_modification_values = zend_hash_num_elements(modification_values);
|
||||
if (num_modification_values == 0) {
|
||||
zend_argument_value_error(3, "the value for option \"" LDAP_MODIFY_BATCH_VALUES "\" must not be empty");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
/* are its keys integers? */
|
||||
if (zend_hash_get_current_key_type(Z_ARRVAL_P(modinfo)) != HASH_KEY_IS_LONG) {
|
||||
zend_value_error("%s(): Option \"" LDAP_MODIFY_BATCH_VALUES "\" must be integer-indexed", get_active_function_name());
|
||||
if (!zend_array_is_list(modification_values)) {
|
||||
zend_argument_value_error(3, "the value for option \"" LDAP_MODIFY_BATCH_VALUES "\" must be a list");
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
/* are the keys consecutive? */
|
||||
for (k = 0; k < num_modvals; k++) {
|
||||
if ((fetched = zend_hash_index_find(Z_ARRVAL_P(modinfo), k)) == NULL) {
|
||||
zend_value_error("%s(): Option \"" LDAP_MODIFY_BATCH_VALUES "\" must have consecutive integer indices starting from 0", get_active_function_name());
|
||||
RETURN_THROWS();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
zend_hash_move_forward(Z_ARRVAL_P(mod));
|
||||
|
|
|
@ -269,8 +269,8 @@ ValueError: ldap_modify_batch(): Option "modtype" must be one of the LDAP_MODIFY
|
|||
ValueError: ldap_modify_batch(): If option "modtype" is LDAP_MODIFY_BATCH_REMOVE_ALL, option "values" cannot be provided
|
||||
ValueError: ldap_modify_batch(): If option "modtype" is not LDAP_MODIFY_BATCH_REMOVE_ALL, option "values" must be provided
|
||||
TypeError: ldap_modify_batch(): Option "values" must be of type array, string given
|
||||
ValueError: ldap_modify_batch(): Option "values" must not be empty
|
||||
ValueError: ldap_modify_batch(): Option "values" must be integer-indexed
|
||||
ValueError: ldap_modify_batch(): Option "values" must have consecutive integer indices starting from 0
|
||||
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must not be empty
|
||||
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be a list
|
||||
ValueError: ldap_modify_batch(): Argument #3 ($modifications_info) the value for option "values" must be a list
|
||||
ValueError: ldap_modify_batch(): Required option "attrib" is missing
|
||||
ValueError: ldap_modify_batch(): Required option "modtype" is missing
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue