Zend Framework

Zend_Validate_Hostname IDN validation not working

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Not an Issue
  • Affects Version/s: 0.9.0
  • Fix Version/s: 1.0.0 RC2
  • Component/s: Zend_Validate
  • Labels:
    None

Description

I can't get IDN hostname validation working at all as of r4097.

$tld = 'höhö.ch';
$hostnameValidator = new Zend_Validate_Hostname();
$hostnameValidator->setValidateIdn(true); // optional as IDN validation should be enabled by default
if (!$hostnameValidator->isValid($tld)) {
    print_r($hostnameValidator->getMessages());
}

prints:

Array
(
    [0] => 'höhö.ch' appears to be a DNS hostname but cannot match against hostname schema for TLD 'ch'
    [1] => 'höhö.ch' does not appear to be a valid local network name
    [2] => 'höhö.ch' appears to be a local network name but but local network names are not allowed
)

while höhö.ch should be a valid IDN hostname.

Issue Links

Activity

Hide
Bill Karwin added a comment -

Assign to Darby.

Show
Bill Karwin added a comment - Assign to Darby.
Hide
Darby Felton added a comment -

Deferring to Simon R Jones for initial comments.

Show
Darby Felton added a comment - Deferring to Simon R Jones for initial comments.
Hide
Simon R Jones added a comment -

I'll take a look into this, this may be some kind of character encoding problem

Show
Simon R Jones added a comment - I'll take a look into this, this may be some kind of character encoding problem
Hide
Simon R Jones added a comment -

Philip,

Can you please try this script out (HostnameTestForm.php), you should access it via a web browser, and let me know if it works for you.

I have managed to replicate your problem though cannot see why its occuring at present. With UTF-8 it seems mostly down to character encoding and that can be a little tricky to pin down. The form based version above should work fine for when accepting IDN hostnames via POST

Show
Simon R Jones added a comment - Philip, Can you please try this script out (HostnameTestForm.php), you should access it via a web browser, and let me know if it works for you. I have managed to replicate your problem though cannot see why its occuring at present. With UTF-8 it seems mostly down to character encoding and that can be a little tricky to pin down. The form based version above should work fine for when accepting IDN hostnames via POST
Hide
Philip Iezzi added a comment -

Thanks Simon. Check out your script at:
http://web.onlime.ch/HostnameTestForm.php
It won't work. I can't tell if my editor (joe under Debian Linux) messed up the encoding of your file. ZF is a "clean" checkout of r4172, no modified files there.

Show
Philip Iezzi added a comment - Thanks Simon. Check out your script at: http://web.onlime.ch/HostnameTestForm.php It won't work. I can't tell if my editor (joe under Debian Linux) messed up the encoding of your file. ZF is a "clean" checkout of r4172, no modified files there.
Hide
Simon R Jones added a comment -

Looks like the upload process messed up the character encoding. I'll put together some test scripts and give you a link to them soon so we can get to the bottom of this

Show
Simon R Jones added a comment - Looks like the upload process messed up the character encoding. I'll put together some test scripts and give you a link to them soon so we can get to the bottom of this
Hide
Simon R Jones added a comment -

Just a note that Alexander Jäger (lx at survive-linux dot com) has also reported this issue. I'll send him a link to test files too to help resolve this issue.

Show
Simon R Jones added a comment - Just a note that Alexander Jäger (lx at survive-linux dot com) has also reported this issue. I'll send him a link to test files too to help resolve this issue.
Hide
Philip Iezzi added a comment -

Sorry about this bogus issue.
This was just a charset issue. My files were ISO-8859-1 encoded and I didn't apply utf8_encode() to the domain prior to passing it to the validator.

solution 1:
Format all your files to UTF-8

solution 2:
$tld = utf8_encode('höhö.ch');

Show
Philip Iezzi added a comment - Sorry about this bogus issue. This was just a charset issue. My files were ISO-8859-1 encoded and I didn't apply utf8_encode() to the domain prior to passing it to the validator. solution 1: Format all your files to UTF-8 solution 2: $tld = utf8_encode('höhö.ch');

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: