Subject: | "uninitialized value used in join" crash from no_escape filter |
Hello!
I think the no_escape filter has a bug that can cause a crash under very specific conditions. On line 41 of TT.pm, if the topic variable is undef, that will cause a "Use of uninitialized value in join or string" warning in the return statement in _hsv_escaped_string. I couldn't figure out a test for it, and I could only reproduce it in my Catalyst app through a weird series of steps. Below is my proposed fix. Please let me know if you'd like me to make any changes. Take care and have a great day!
Cheers,
Fitz
diff --git a/lib/site_perl/5.16.3/HTML/String/TT.pm b/lib/site_perl/5.16.3/HTML/String/TT.pm
index 0244de8..1b519e5 100644
--- a/lib/site_perl/5.16.3/HTML/String/TT.pm
+++ b/lib/site_perl/5.16.3/HTML/String/TT.pm
@@ -38,7 +38,7 @@ sub new {
FILTERS => { no_escape => sub {
$_[0]->$_isa('HTML::String::Value')
? HTML::String::Value->new(map $_->[0], @{$_[0]->{parts}})
- : HTML::String::Value->new($_)
+ : HTML::String::Value->new($_[0])
} },
(ref($_[0]) eq 'HASH' ? %{$_[0]} : @_)
);