History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-84
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Simon R Jones
Reporter: Naoto Ishikawa
Votes: 2
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Filter::isHostname not allow a hostname that has one character part like "d.hatena.ne.jp" (TRAC-130)

Created: 20/Jun/06 11:46 PM   Updated: 19/Dec/08 01:50 PM
Component/s: Zend_Validate
Affects Version/s: 0.1.3
Fix Version/s: 0.8.0

Time Tracking:
Not Specified

Issue Links:
Dependency
 
Duplicate
 

Tags:
Participants: Bill Karwin, Cameron Brunner, Chris Shiflett, Darby Felton, Gavin, Gregory Szorc, Kevin Golding, Mark Evans, Naoto Ishikawa, Simon R Jones and Wil Sinclair


 Description  « Hide
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.



 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Mark Evans - 09/Jul/06 08:55 AM
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?

Kevin Golding - 17/Jul/06 09:59 AM
Well according to RFC2181:

The DNS itself places only one restriction on the particular labels
that can be used to identify resource records. That one restriction
relates to the length of the label and the full name. The length of
any one label is limited to between 1 and 63 octets. A full domain
name is limited to 255 octets (including the separators).

Based on that logic the fix looks valid.


Cameron Brunner - 28/Aug/06 03:54 AM
This is bothering me as well, I cant use Zend_Feed due to it using the hostname validation from this. Are there any plans to impliment this patch? This patch seems to fix the problems i have as well.

Bill Karwin - 13/Nov/06 03:23 PM
Changing fix version to 0.9.0.

Gavin - 15/Nov/06 08:49 PM
I won't promise this issue is fixed by the patch I committed, but it is an improvement.
Unless I hear otherwise from the community, I consider this issue "resolved" for the moment.

Darby Felton - 16/Nov/06 08:26 AM
Please provide unit tests to at least indicate the effects of the change.

Also, please replace tab characters for indent with 4 spaces, per the coding standards.


Chris Shiflett - 25/Nov/06 08:48 PM
The isHostname() implementation needs to be rewritten, in my opinion. If someone could write a good test suite, I'd be happy to have a look at it.

Gregory Szorc - 15/Feb/07 12:58 AM
moving to Zend_Validate component b/c Zend_Filter static methods are deprecated as of 0.8.0.

Simon R Jones - 15/Feb/07 08:22 AM
Fixed with revision 3429, d.hatena.ne.jp has been added in the unit test and it passes validation.

Wil Sinclair - 19/Dec/08 01:48 PM
Bookkeeping. Closing old issues and assigning them to the person who ultimately resolved the issue.