mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 12:11:02 +01:00
fix rt.cpan.org#104548
git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@102 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2.57 - fix rt.cpan.org#104548, dont allow special chars like newline
|
||||
or < in keys, which leads to faile when saving.
|
||||
|
||||
2.56 - fix rt.cpan.org#95325
|
||||
|
||||
2.55 - fix rt.cpan.org#95314
|
||||
|
||||
2.54 - fixed rt.cpan.org#39814. changed the order of pre-processing
|
||||
in _read(): 1) remove comments, 2) check for continuation,
|
||||
3) remove empty lines.
|
||||
|
||||
11
General.pm
11
General.pm
@@ -5,7 +5,7 @@
|
||||
# config values from a given file and
|
||||
# return it as hash structure
|
||||
#
|
||||
# Copyright (c) 2000-2014 Thomas Linden <tlinden |AT| cpan.org>.
|
||||
# Copyright (c) 2000-2015 Thomas Linden <tlinden |AT| cpan.org>.
|
||||
# All Rights Reserved. Std. disclaimer applies.
|
||||
# Artistic License, same as perl itself. Have fun.
|
||||
#
|
||||
@@ -32,7 +32,7 @@ use Carp::Heavy;
|
||||
use Carp;
|
||||
use Exporter;
|
||||
|
||||
$Config::General::VERSION = "2.56";
|
||||
$Config::General::VERSION = "2.57";
|
||||
|
||||
use vars qw(@ISA @EXPORT_OK);
|
||||
use base qw(Exporter);
|
||||
@@ -1258,6 +1258,11 @@ sub _store {
|
||||
my $config_string = q();
|
||||
|
||||
foreach my $entry ( $this->{SaveSorted} ? sort keys %$config : keys %$config ) {
|
||||
# fix rt#104548
|
||||
if ($entry =~ /[<>\n\r]/) {
|
||||
croak "Config::General: current key contains invalid characters: $entry!\n";
|
||||
}
|
||||
|
||||
if (ref($config->{$entry}) eq 'ARRAY') {
|
||||
if( $this->{ForceArray} && scalar @{$config->{$entry}} == 1 && ! ref($config->{$entry}->[0]) ) {
|
||||
# a single value array forced to stay as array
|
||||
@@ -2748,7 +2753,7 @@ Thomas Linden <tlinden |AT| cpan.org>
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
2.56
|
||||
2.57
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
8
t/run.t
8
t/run.t
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
use Data::Dumper;
|
||||
use Test::More tests => 71;
|
||||
use Test::More tests => 72;
|
||||
#use Test::More qw(no_plan);
|
||||
|
||||
# ahem, we deliver the test code with a local copy of
|
||||
@@ -742,3 +742,9 @@ is($hash54{val}, qq(\\\$notavar:\\blah), "check -NoEscape");
|
||||
my $cfg55 = new Config::General( -ConfigFile => "t/cfg.55" );
|
||||
my %hash55 = $cfg55->getall();
|
||||
is($hash55{b}, "nochop", "check continuation followed by empty line");
|
||||
|
||||
my $cfg56 = Config::General->new();
|
||||
eval {
|
||||
$cfg56->save_file("t/56.out", { "new\nline" => 9, "brack<t" => 8 });
|
||||
};
|
||||
ok($@, "catch special chars in keys");
|
||||
|
||||
Reference in New Issue
Block a user