Skip to content

Commit

Permalink
Merge pull request sympa-community#954 from ikedas/issue-953 by ikedas
Browse files Browse the repository at this point in the history
"false" values in XML file prevent list creation (sympa-community#953)
  • Loading branch information
ikedas committed Jun 6, 2020
2 parents ebe7837 + 6000514 commit 680b0d4
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/Sympa/Config_XML.pm
Expand Up @@ -168,7 +168,7 @@ sub _getChildren {
if ($type == 1) {
# ELEMENT_NODE
my $values = _getChildren($child);
return undef unless $values;
return undef unless defined $values;

if ($child->getAttribute('multiple')) {
push @{$multiple_nodes->{$childName}}, $values;
Expand Down
28 changes: 28 additions & 0 deletions t/Config_XML.t
Expand Up @@ -59,6 +59,16 @@ is_deeply(
is(Sympa::Config_XML->new(IO::Scalar->new(\(shift @in)))->as_hashref, undef);
is(Sympa::Config_XML->new(IO::Scalar->new(\(shift @in)))->as_hashref, undef);

# GH#953: "false" values in XML file prevent list creation
if (isnt(
my $h =
Sympa::Config_XML->new(IO::Scalar->new(\(shift @in)))->as_hashref,
undef
)
) {
is($h->{filtre}, '0');
}

done_testing();

__END__
Expand Down Expand Up @@ -126,3 +136,21 @@ __END__
</owner>
</list>
<?xml version="1.0" encoding="UTF-8"?>
<list>
<listname>liste.org1.test</listname>
<subject>Liste test</subject>
<custom_subject>TEST</custom_subject>
<topics>communication</topics>
<reply_mail>noreply@domaine.fr</reply_mail>
<status>open</status>
<source>mysql</source>
<send>diffuseur</send>
<filtre>0</filtre>
<owner multiple="1">
<email>listmaster@domaine.fr</email>
<gecos>listmaster</gecos>
<reception>mail</reception>
</owner>
</list>

0 comments on commit 680b0d4

Please sign in to comment.