Fix Stow to always return safe copies of stowed data.
And test it.
This commit is contained in:
parent
159f2daf60
commit
19987b53b4
2 changed files with 13 additions and 1 deletions
|
|
@ -109,6 +109,18 @@ sub get {
|
|||
my $self = shift;
|
||||
my $var = shift;
|
||||
return undef if $self->session->config->get("disableCache");
|
||||
my $ref = $self->{_data}{$var};
|
||||
if (ref $ref eq 'ARRAY') {
|
||||
my @safeArray = @{ $ref };
|
||||
return \@safeArray;
|
||||
}
|
||||
elsif (ref $ref eq 'HASH') {
|
||||
my %safeHash = %{ $ref };
|
||||
return \%safeHash;
|
||||
}
|
||||
else {
|
||||
return $ref
|
||||
}
|
||||
return $self->{_data}{$var};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue