diff options
author | Matthew Somerville <matthew@mysociety.org> | 2013-02-04 12:03:55 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2013-02-04 12:03:55 +0000 |
commit | 652f1c552c27831cf78ba6fb6308463ee513023d (patch) | |
tree | a37bd72d078f170b6bf3e7c511316d2beb0039cd /perllib/FixMyStreet/App/Controller/Reports.pm | |
parent | 3609368292003c773ae27e9b3da753e36cf3455d (diff) |
Fix infinite memory-eating loop.
Reading from $problem->areas is a new string each time, so the
global regex gets reset and the loop never ends. Look up the value
once, first, to prevent this.
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Reports.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 144e6e227..a4dcaeeb8 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -419,7 +419,8 @@ sub load_and_group_problems : Private { } if ( !$problem->bodies_str ) { # Problem was not sent to any body, add to all possible areas XXX - while ($problem->areas =~ /,(\d+)(?=,)/g) { + my $a = $problem->areas; # Store, as otherwise is looked up every iteration. + while ($a =~ /,(\d+)(?=,)/g) { add_row( $c, $problem, $1, \%problems, \@pins ); } } else { |