Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Domain-PublicSuffix CPAN distribution.

Report information
The Basics
Id: 84012
Status: resolved
Priority: 0/
Queue: Domain-PublicSuffix

People
Owner: Nobody in particular
Requestors: gavin [...] openfusion.com.au
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.08
Fixed in: (no value)

Attachments
Domain-PublicSuffix-0.08-0.com.unit-test.patch
Domain-PublicSuffix-0.08-bugfix-false-segments.patch



Subject: Bug with domain segments that evaluate to false
Download (untitled) / with headers
text/plain 228b
Hi Nick, Just noticed there's a bug with domain segments that evaluate to false e.g. www.1.com correctly returns 1.com as root domain, but www.0.com just returns 'com'. Failing unit test patch and fix attached. Cheers, Gavin
Subject: Domain-PublicSuffix-0.08-bugfix-false-segments.patch
From 4a626b5bf4970032706d455f4bfd0497bd8fc544 Mon Sep 17 00:00:00 2001 From: Gavin Carr <gavin@openfusion.com.au> Date: Mon, 18 Mar 2013 12:36:28 +1100 Subject: [PATCH] Add fix for domain segments evaluating to false. --- lib/Domain/PublicSuffix.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Domain/PublicSuffix.pm b/lib/Domain/PublicSuffix.pm index bf8e507..49a8aaf 100755 --- a/lib/Domain/PublicSuffix.pm +++ b/lib/Domain/PublicSuffix.pm @@ -165,7 +165,7 @@ sub get_root_domain { while ( !$self->suffix and scalar(@domain_array) > 0 ) { my $sub = pop(@domain_array); - next if (!$sub); + next if (! defined $sub); # check if $sub.$last is a root if ( defined $last->{$sub} and scalar(keys %{$last->{$sub}}) == 0 ) { -- 1.7.1
Subject: Domain-PublicSuffix-0.08-0.com.unit-test.patch
From 67e204bed82569a5f636a6a452cfff551a607480 Mon Sep 17 00:00:00 2001 From: Gavin Carr <gavin@openfusion.com.au> Date: Mon, 18 Mar 2013 12:35:10 +1100 Subject: [PATCH] Add failing test for www.0.com to 01-core.t. --- t/01-core.t | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/t/01-core.t b/t/01-core.t index bd97aca..960fdb4 100755 --- a/t/01-core.t +++ b/t/01-core.t @@ -15,6 +15,9 @@ is( $ps->get_root_domain('www.google.co.uk'), 'google.co.uk', 'www-to-root-co-uk is( $ps->tld(), 'uk', , 'root-to-root-co-uk-tld' ); is( $ps->suffix(), 'co.uk', , 'root-to-root-co-uk-etld' ); +is( $ps->get_root_domain('www.0.com'), '0.com' , '0.com' ); +is( $ps->tld(), 'com', , '0.com-tld' ); + is( $ps->get_root_domain('not_valid_at_all'), undef , 'invalid-domain' ); is( $ps->error, 'Malformed domain', , 'domain-error' ); -- 1.7.1
Added and released as 0.09. Thanks for the patch!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.