Quick fix for breakage on the page caused by open textarea tags.
Patch by exor674.
diffs (35 lines):
diff -r d3f0f161fbb2 -r b9f5b8c8d5c0 cgi-bin/LJ/CleanHTML.pm
--- a/cgi-bin/LJ/CleanHTML.pm Tue Jan 04 10:40:47 2011 +0800
+++ b/cgi-bin/LJ/CleanHTML.pm Tue Jan 04 10:44:22 2011 +0800
@@ -1124,6 +1124,12 @@ sub clean
}
}
+ # if we have a textarea open, we *MUST* close it first
+ if ( $opencount{textarea} ) {
+ $newdata .= "</textarea>";
+ }
+ $opencount{textarea} = 0;
+
# close any tags that were opened and not closed
# don't close tags that don't need a closing tag -- otherwise,
# we output the closing tags in the wrong place (eg, a </td>
diff -r d3f0f161fbb2 -r b9f5b8c8d5c0 t/clean-event.t
--- a/t/clean-event.t Tue Jan 04 10:40:47 2011 +0800
+++ b/t/clean-event.t Tue Jan 04 10:44:22 2011 +0800
@@ -136,6 +136,15 @@ is( $orig_post, $cut_text, "Text under f
$clean->( { cut_retrieve => 2 } );
is( $orig_post, $cut_text, "Text under second cut, with HTML tags" );
+$orig_post = qq{<strong><textarea></strong>};
+$clean_post = qq{<strong><textarea></strong></textarea></strong>};
+$clean->();
+is( $orig_post, $clean_post, "Open textarea tag" );
+
+$orig_post = qq{<textarea><textarea></textarea>};
+$clean_post = qq{<textarea><textarea></textarea>};
+$clean->();
+is( $orig_post, $clean_post, "Double textarea tag" );
# nested cut tags
$entry_text = qq{<cut text="outer">out <cut text="inner">in</cut></cut>};
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog