@@ -2688,25 +2688,25 @@ PHP_FUNCTION(ldap_modify_batch)
2688
2688
ldap_mods [modification_index ]-> mod_bvalues = safe_emalloc ((num_modification_values + 1 ), sizeof (struct berval * ), 0 );
2689
2689
2690
2690
/* for each value */
2691
- for ( uint32_t j = 0 ; j < num_modification_values ; j ++ ) {
2692
- /* fetch it */
2693
- zval * fetched = zend_hash_index_find (Z_ARRVAL_P (modification_values ), j );
2694
- zend_string * modval = zval_get_string (fetched );
2691
+ zend_ulong value_index = 0 ;
2692
+ zval * modification_value_zv = NULL ;
2693
+ ZEND_HASH_FOREACH_NUM_KEY_VAL (Z_ARRVAL_P (modification_values ), value_index , modification_value_zv ) {
2694
+ zend_string * modval = zval_get_string (modification_value_zv );
2695
2695
if (EG (exception )) {
2696
2696
RETVAL_FALSE ;
2697
- ldap_mods [modification_index ]-> mod_bvalues [j ] = NULL ;
2697
+ ldap_mods [modification_index ]-> mod_bvalues [value_index ] = NULL ;
2698
2698
num_mods = modification_index + 1 ;
2699
2699
goto cleanup ;
2700
2700
}
2701
2701
2702
2702
/* allocate the data struct */
2703
- ldap_mods [modification_index ]-> mod_bvalues [j ] = safe_emalloc (1 , sizeof (struct berval ), 0 );
2703
+ ldap_mods [modification_index ]-> mod_bvalues [value_index ] = safe_emalloc (1 , sizeof (struct berval ), 0 );
2704
2704
2705
2705
/* fill it */
2706
- ldap_mods [modification_index ]-> mod_bvalues [j ]-> bv_len = ZSTR_LEN (modval );
2707
- ldap_mods [modification_index ]-> mod_bvalues [j ]-> bv_val = estrndup (ZSTR_VAL (modval ), ZSTR_LEN (modval ));
2706
+ ldap_mods [modification_index ]-> mod_bvalues [value_index ]-> bv_len = ZSTR_LEN (modval );
2707
+ ldap_mods [modification_index ]-> mod_bvalues [value_index ]-> bv_val = estrndup (ZSTR_VAL (modval ), ZSTR_LEN (modval ));
2708
2708
zend_string_release (modval );
2709
- }
2709
+ } ZEND_HASH_FOREACH_END ();
2710
2710
2711
2711
/* NULL-terminate values */
2712
2712
ldap_mods [modification_index ]-> mod_bvalues [num_modification_values ] = NULL ;
0 commit comments