fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-06-11 09:21 am

[dw-free] Don't pass undef to Cache::Memcached->add/replace/set

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

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

Avoid warnings in the logs, caused by passing in undefined values.

Patch by LiveJournal, packaged for Dreamwidth by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/MemCache.pm
--------------------------------------------------------------------------------
diff -r d20f5aa3535b -r 92e48ffb8d08 cgi-bin/LJ/MemCache.pm
--- a/cgi-bin/LJ/MemCache.pm	Fri Jun 11 17:11:55 2010 +0800
+++ b/cgi-bin/LJ/MemCache.pm	Fri Jun 11 17:27:47 2010 +0800
@@ -123,9 +123,12 @@ sub delete {
     $memc->delete(@_, 4) || $memc->delete(@_);
 }
 
-sub add       { $memc->add(@_);       }
-sub replace   { $memc->replace(@_);   }
-sub set       { $memc->set(@_);       }
+sub add       { ( defined $_[1] ) ? $memc->add( @_ )
+                                  : $memc->add( $_[0],     '', $_[2] ); }
+sub replace   { ( defined $_[1] ) ? $memc->replace( @_ )
+                                  : $memc->replace( $_[0], '', $_[2] ); }
+sub set       { ( defined $_[1] ) ? $memc->set( @_ )
+                                  : $memc->set( $_[0],     '', $_[2] ); }
 sub incr      { $memc->incr(@_);      }
 sub decr      { $memc->decr(@_);      }
 
--------------------------------------------------------------------------------