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