@@ -2527,7 +2527,7 @@ PHP_FUNCTION(ldap_modify_batch)
25272527 zval * fetched ;
25282528 char * dn ;
25292529 size_t dn_len ;
2530- int i , j , k ;
2530+ int i , j ;
25312531 int num_mods , num_modprops , num_modvals ;
25322532 LDAPMod * * ldap_mods ;
25332533 LDAPControl * * lserverctrls = NULL ;
@@ -2682,27 +2682,17 @@ PHP_FUNCTION(ldap_modify_batch)
26822682 }
26832683
26842684 SEPARATE_ARRAY (modinfo );
2685+ const HashTable * modification_values = Z_ARRVAL_P (modinfo );
26852686 /* 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" );
26902690 RETURN_THROWS ();
26912691 }
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" );
26962694 RETURN_THROWS ();
26972695 }
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- }
27062696 }
27072697
27082698 zend_hash_move_forward (Z_ARRVAL_P (mod ));
0 commit comments