@@ -2687,25 +2687,25 @@ PHP_FUNCTION(ldap_modify_batch)
26872687 ldap_mods [modification_index ]-> mod_bvalues = safe_emalloc ((num_modification_values + 1 ), sizeof (struct berval * ), 0 );
26882688
26892689 /* 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 );
26942694 if (EG (exception )) {
26952695 RETVAL_FALSE ;
2696- ldap_mods [modification_index ]-> mod_bvalues [j ] = NULL ;
2696+ ldap_mods [modification_index ]-> mod_bvalues [value_index ] = NULL ;
26972697 num_mods = modification_index + 1 ;
26982698 goto cleanup ;
26992699 }
27002700
27012701 /* 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 );
27032703
27042704 /* 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 ));
27072707 zend_string_release (modval );
2708- }
2708+ } ZEND_HASH_FOREACH_END ();
27092709
27102710 /* NULL-terminate values */
27112711 ldap_mods [modification_index ]-> mod_bvalues [num_modification_values ] = NULL ;
0 commit comments