Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 0.1.3
-
Fix Version/s: 0.8.0
-
Component/s: Zend_Validate
-
Labels:None
Description
Zend_Filter::isHostname returns false,
When it called with a hostname that has one character part.
ex) "d.hatena.ne.jp", "a.hatena.ne.jp"
The reason is following regular expression code.
// check input against domain name schema
- $status = @preg_match('/^(?:[^\W_](?:[^\W_]|-){0,61}[^\W_]\.)+[a-zA-Z]{2,6}\.?$/', $value);
I changed like this, that returns true by calling with a hostname with one character part.
// check input against domain name schema
+ $status = @preg_match('/^(?:[^\W_]((?:[^\W_]|-){0,61}[^\W_])?\.)+[a-zA-Z]{2,6}\.?$/', $value);
But I don't know it's valid for RFCs about URI.
I think this fix is not so good.
I have been looking for the RFC which specifies the hostname requirements and cannot find any restriction on the number of characters as part of a domain name, does anyone know if there is a restriction or can this fixed be applied?