mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-08-07 03:42 pm

[dw-free] Fix error log message:

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

Fix error log message:

value for memkey:embedcont:221015:180 is not defined at /home/dw/current
/cgi-bin/Cache/Memcached.pm line 476

Turns out, the HTML cleaner has a bogus mode where if you pass it an empty
string or something that entirely gets stripped, it returns undef. This
causes a problem later when Cache::Memcached tries to store it.

Patch by [staff profile] mark.

Files modified:
  • cgi-bin/cleanhtml.pl
--------------------------------------------------------------------------------
diff -r 7ae5063f002e -r 255031e8e79e cgi-bin/cleanhtml.pl
--- a/cgi-bin/cleanhtml.pl	Fri Aug 07 09:42:53 2009 -0500
+++ b/cgi-bin/cleanhtml.pl	Fri Aug 07 15:42:52 2009 +0000
@@ -97,8 +97,13 @@ sub clean
 sub clean
 {
     my $data = shift;
+    return undef unless defined $$data;
+
     my $opts = shift;
-    my $newdata;
+
+    # this has to be an empty string because otherwise we might never actually append
+    # anything to it if $$data contains only invalid content
+    my $newdata = '';
 
     # remove the auth portion of any see_request.bml links
     $$data =~ s/(see_request\.bml\S+?)auth=\w+/$1/ig;
--------------------------------------------------------------------------------
kareila: Taking refuge from falling debris under a computer desk. (computercrash)

[personal profile] kareila 2009-08-07 04:19 pm (UTC)(link)
If this is in lieu of the patch I submitted last night on bug 548 for the same problem, can you clear the flags on that and close the bug? Thanks.