http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4829
Summary: Using each to iterate through arrays then exiting early
causes problems
Product: Spamassassin
Version: 3.1.1
Platform: Other
OS/Version: other
Status: NEW
Severity: major
Priority: P5
Component: Libraries
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
While trying to debug why my plugin from bug 4255 was sometimes not hitting on
certain rules I came
across the behavior where the "while(...each...)" wasn't going through all of
the entries in the hash table.
After some digging, I found that somewhere in SA, we start iterating through
the $permsgstatus->
{html}->{uri_detail} hash via each and exit early, presumably when a rule hits.
However, perl keeps the
iteration state when using each(), and then when we try doing each over the
same array in another
section of code, we miss hash entries. To see what I mean:
$ perl -e '%t=map{$_=>1}qw/1 2 3/; while(($k,$v)=each %t){print "1: $k\n";
last;} while(($k,$v)=each %
t){print "2: $k\n";}'
1: 1
2: 3
2: 2
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.