Closed Bug 2530 Opened 26 years ago Closed 26 years ago

mulivalued lists do not maintain their order

Categories

(Directory :: PerLDAP, defect, P1)

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: yakk0_77, Assigned: leif)

Details

If I add values to an entry object in the order 1,2,3,4 the update method to Conn.pm may, or may not preserve their order. The problem is in the way update() checks for duplicate values in the multivalued lists. The problem code is: if ($#vals == $[) { $mod{$key} = { "rb", [$vals[$[]] }; } else { @arr = (); grep(($new{$_} = 1), @vals); foreach (@{$entry->{"_${key}_save_"}}) { if (! $new{$_}) { push(@arr, $_); } $new{$_} = 0; } $mod{$key}{"db"} = [@arr] if ($#arr >= $[); @arr = (); foreach (keys(%new)) { push(@arr, $_) if ($new{$_} == 1); } $mod{$key}{"ab"} = [@arr] if ($#arr >= $[); } The problem is that doing a foreach on the keys in %new doesn't preserve their order. Here is an example of how to create a @arr from @vals without changing the order of the values in @arr: foreach $value (@vals) { if($check{lc($value)}) { next; } else { $check{lc($value)} = 1; push(@arr, $value); } }
Status: NEW → ASSIGNED
Setting all current Open/Normal to M4.
Clearing "M" field since Directory product is not used for 5.0 specific project bug metrics and will mess up our queries on milestones.
Severity: normal → major
Priority: P2 → P1
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
I'm hoping this is fixed, please reopen the bug if it isn't!
You need to log in before you can comment on or make changes to this bug.