Skip to content

Commit

Permalink
Item12952: protect hash keys that are'nt perl words; compare undef sa…
Browse files Browse the repository at this point in the history
…fely
  • Loading branch information
crawford committed Sep 2, 2014
1 parent bd55e14 commit 700e532
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/lib/Foswiki/Configure/Wizards/Save.pm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ sub _perlKeys {
# Make a single key safe for use in perl
sub _perlKey {
my $k = shift;
return $k unless $k =~ /\W/;
return $k if $k =~ /^[a-zA-Z_]\w+$/;
$k =~ s/'/\\'/g;
return "'$k'";
}
Expand Down Expand Up @@ -297,6 +297,8 @@ sub _match {

$oval = _dumpVal( \$oval ) if ( ref($oval) );
$nval = _dumpVal( \$nval ) if ( ref($nval) );
$oval = 'undef' unless defined $oval;
$nval = 'undef' unless defined $nval;

if ( $oval ne $nval ) {
push @{ $log->{"'$ai->[$a]'"} }, ( 'CHANGE', $oval, $nval );
Expand Down

0 comments on commit 700e532

Please sign in to comment.