Issues

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

Issue Type: Bug Created: 2006-06-20T23:46:37.000+0000 Last Updated: 2008-12-19T13:50:00.000+0000 Status: Closed Fix version(s): - 0.8.0 (21/Feb/07)

Reporter: Naoto Ishikawa (ishinao) Assignee: Simon R Jones (studio24) Tags: - Zend_Validate

Related issues: - ZF-881

Attachments:

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_{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_?.)+[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.

Comments

Posted by Mark Evans (sparky) on 2006-07-09T08:55:42.000+0000

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?

Posted by Kevin Golding (caomhin) on 2006-07-17T09:59:08.000+0000

Well according to RFC2181:

{quote} 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). {quote}

Based on that logic the fix looks valid.

Posted by Cameron Brunner (trophaeum) on 2006-08-28T03:54:51.000+0000

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.

Posted by Bill Karwin (bkarwin) on 2006-11-13T15:23:35.000+0000

Changing fix version to 0.9.0.

Posted by Gavin (gavin) on 2006-11-15T20:49:52.000+0000

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.

Posted by Darby Felton (darby) on 2006-11-16T08:26:14.000+0000

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.

Posted by Chris Shiflett (chris) on 2006-11-25T20:48:51.000+0000

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.

Posted by Gregory Szorc (indygreg) on 2007-02-15T00:58:00.000+0000

moving to Zend_Validate component b/c Zend_Filter static methods are deprecated as of 0.8.0.

Posted by Simon R Jones (studio24) on 2007-02-15T08:22:39.000+0000

Fixed with revision 3429, d.hatena.ne.jp has been added in the unit test and it passes validation.

Posted by Wil Sinclair (wil) on 2008-12-19T13:48:17.000+0000

Bookkeeping. Closing old issues and assigning them to the person who ultimately resolved the issue.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts