Index: tests/Zend/Validate/HostnameTest.php =================================================================== --- tests/Zend/Validate/HostnameTest.php (revision 23450) +++ tests/Zend/Validate/HostnameTest.php (working copy) @@ -406,4 +406,12 @@ } } } + + /** + * @group ZF-6363 + */ + public function testValidWithTrailingDot() + { + $this->assertTrue($this->_validator->isValid('www.bob.com.')); + } } Index: library/Zend/Validate/Hostname.php =================================================================== --- library/Zend/Validate/Hostname.php (revision 23450) +++ library/Zend/Validate/Hostname.php (working copy) @@ -512,6 +512,16 @@ } } + // According to RFC3986 (Uniform Resource Identifier: Generic Syntax) + // section 3.2.2, a trailing dot is allowed. However, it is not + // mandated. + // + // Therefore, we strip it, so the checks below will not + // suffer from it. + if (strripos($value, '.') === strlen($value)-1) { + $value = substr($value, 0, strlen($value)-1); + } + // Check input against DNS hostname schema $domainParts = explode('.', $value); if ((count($domainParts) > 1) && (strlen($value) >= 4) && (strlen($value) <= 254)) {