@@ -2527,7 +2527,7 @@ PHP_FUNCTION(ldap_modify_batch)
2527
2527
zval * fetched ;
2528
2528
char * dn ;
2529
2529
size_t dn_len ;
2530
- int i , j , k ;
2530
+ int i , j ;
2531
2531
int num_mods , num_modprops , num_modvals ;
2532
2532
LDAPMod * * ldap_mods ;
2533
2533
LDAPControl * * lserverctrls = NULL ;
@@ -2682,27 +2682,17 @@ PHP_FUNCTION(ldap_modify_batch)
2682
2682
}
2683
2683
2684
2684
SEPARATE_ARRAY (modinfo );
2685
+ const HashTable * modification_values = Z_ARRVAL_P (modinfo );
2685
2686
/* is the array not empty? */
2686
- zend_hash_internal_pointer_reset (Z_ARRVAL_P (modinfo ));
2687
- num_modvals = zend_hash_num_elements (Z_ARRVAL_P (modinfo ));
2688
- if (num_modvals == 0 ) {
2689
- zend_value_error ("%s(): Option \"" LDAP_MODIFY_BATCH_VALUES "\" must not be empty" , get_active_function_name ());
2687
+ uint32_t num_modification_values = zend_hash_num_elements (modification_values );
2688
+ if (num_modification_values == 0 ) {
2689
+ zend_argument_value_error (3 , "the value for option \"" LDAP_MODIFY_BATCH_VALUES "\" must not be empty" );
2690
2690
RETURN_THROWS ();
2691
2691
}
2692
-
2693
- /* are its keys integers? */
2694
- if (zend_hash_get_current_key_type (Z_ARRVAL_P (modinfo )) != HASH_KEY_IS_LONG ) {
2695
- zend_value_error ("%s(): Option \"" LDAP_MODIFY_BATCH_VALUES "\" must be integer-indexed" , get_active_function_name ());
2692
+ if (!zend_array_is_list (modification_values )) {
2693
+ zend_argument_value_error (3 , "the value for option \"" LDAP_MODIFY_BATCH_VALUES "\" must be a list" );
2696
2694
RETURN_THROWS ();
2697
2695
}
2698
-
2699
- /* are the keys consecutive? */
2700
- for (k = 0 ; k < num_modvals ; k ++ ) {
2701
- if ((fetched = zend_hash_index_find (Z_ARRVAL_P (modinfo ), k )) == NULL ) {
2702
- zend_value_error ("%s(): Option \"" LDAP_MODIFY_BATCH_VALUES "\" must have consecutive integer indices starting from 0" , get_active_function_name ());
2703
- RETURN_THROWS ();
2704
- }
2705
- }
2706
2696
}
2707
2697
2708
2698
zend_hash_move_forward (Z_ARRVAL_P (mod ));
0 commit comments