Skip Menu |

This queue is for tickets about the Template-Toolkit CPAN distribution.

Report information
The Basics
Id: 85607
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: OPI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 2.24
Fixed in: 2.25



Subject: image plugin suffers from hash randomization in perl 5.18
besides the vmethod/text failure due to behavior changes in split() 2.24 also suffers from hash randomization in Plugin::Image. Here is a simple patch. I think it is important to have a well-defined order in the tag method's output to make caching possible. --- lib/Template/Plugin/Image.pm~ 2011-12-20 08:41:35.000000000 +0100 +++ lib/Template/Plugin/Image.pm 2013-05-25 13:43:30.658308009 +0200 @@ -165,8 +165,8 @@ unless defined $options->{ alt }; if (%$options) { - while (my ($key, $val) = each %$options) { - my $escaped = escape( $val ); + for my $key (sort keys %$options) { + my $escaped = escape( $options->{$key} ); $tag .= qq[ $key="$escaped"]; } }
On Sat 25 Mei 2013 08:10:50, OPI wrote: Show quoted text
> besides the vmethod/text failure due to behavior changes in split() > 2.24 also suffers from hash randomization in Plugin::Image. > > Here is a simple patch. I think it is important to have a well-defined > order in the tag method's output to make caching possible. > > --- lib/Template/Plugin/Image.pm~ 2011-12-20 08:41:35.000000000 > +0100 > +++ lib/Template/Plugin/Image.pm 2013-05-25 13:43:30.658308009 > +0200 > @@ -165,8 +165,8 @@ > unless defined $options->{ alt }; > > if (%$options) { > - while (my ($key, $val) = each %$options) { > - my $escaped = escape( $val ); > + for my $key (sort keys %$options) { > + my $escaped = escape( $options->{$key} ); > $tag .= qq[ $key="$escaped"]; > } > }
This was fixed in https://github.com/abw/Template2/commit/a41a2b02fe54246856f6611528e31e12173dcea1 which is in version 2.25. It can be closed.
Ticket migrated to github as https://github.com/abw/Template2/issues/160