Skip to content

Commit 7da7faa

Browse files
committed
[3.0] Strip FQDN period from the end of the domain
As brought up in #229 we're already treating all domains as absolute, so adding direct support for it is a small bug fix. That said, fully support for search domains requires a different handling of this and will be done in a different PR.
1 parent 30c5e43 commit 7da7faa

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
name: PHPUnit (PHP ${{ matrix.php }})
1010
runs-on: ubuntu-22.04
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
php:
1415
- 8.3
@@ -24,7 +25,7 @@ jobs:
2425
- uses: shivammathur/setup-php@v2
2526
with:
2627
php-version: ${{ matrix.php }}
27-
coverage: xdebug
28+
coverage: ${{ matrix.php < 8.0 && 'xdebug' || 'pcov' }}
2829
ini-file: development
2930
- run: composer install
3031
- run: vendor/bin/phpunit --coverage-text

src/Resolver/Resolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function resolve($domain)
2828

2929
public function resolveAll($domain, $type)
3030
{
31+
$domain = trim($domain, '.');
3132
$query = new Query($domain, $type, Message::CLASS_IN);
3233

3334
return $this->executor->query(

tests/FunctionalResolverTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ public function testResolveGoogleResolves()
4848
Loop::run();
4949
}
5050

51+
/**
52+
* @group internet
53+
*/
54+
public function testResolveGoogleFQDNResolves()
55+
{
56+
$promise = $this->resolver->resolve('google.com.');
57+
$promise->then($this->expectCallableOnce(), $this->expectCallableNever());
58+
59+
Loop::run();
60+
}
61+
5162
/**
5263
* @group internet
5364
*/

0 commit comments

Comments
 (0)