fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-04-16 09:31 am

[dw-free] Fix variable interpolation errors in memcache keys

[commit: http://hg.dwscoalition.org/dw-free/rev/e8c5b8f681f4]

http://bugs.dwscoalition.org/show_bug.cgi?id=4405

Don't put the $u->userid function call inside the string.

Patch by [personal profile] exor674.

Files modified:
  • cgi-bin/LJ/Poll.pm
--------------------------------------------------------------------------------
diff -r 559b0b9dffd6 -r e8c5b8f681f4 cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm	Mon Apr 16 17:27:37 2012 +0800
+++ b/cgi-bin/LJ/Poll.pm	Mon Apr 16 17:33:42 2012 +0800
@@ -632,7 +632,7 @@
     my $pollid = $self->pollid;
 
     # try getting first from memcache
-    my $memkey = [$u->userid, "pollresults:$u->userid:$pollid"];
+    my $memkey = [$u->userid, "pollresults:" . $u->userid . ":$pollid"];
     my $result = LJ::MemCache::get( $memkey );
     return %$result if $result;
 
@@ -1495,7 +1495,7 @@
     }
 
     # delete user answer MemCache entry
-    my $memkey = [$remote->userid, "pollresults:$remote->userid:$pollid"];
+    my $memkey = [$remote->userid, "pollresults:" . $remote->userid . ":$pollid"];
     LJ::MemCache::delete( $memkey );
 
     # if unique prop is on, make sure that a particular email address can only vote once
--------------------------------------------------------------------------------