Zend Framework

Zend_Validate_Hostname fails if Punycode is used for IDN

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.8.0
  • Component/s: Zend_Validate
  • Labels:
    None

Description

If ACE is used for an IDN like müller.de (which is xn--mller-kva.de) Zend_Validate_Hostname fails, because the ACE prefix has a dash in the third and fourth position. At least the IDNA prefix xn-- should be supported, as there are a couple of use-cases, that allow using ACE in RFC 3490.

As exposing the user to raw ACE should be avoided if possible the support for xn-- can be added as an option, which defaults to false.

Reproduce with:
<?php
require_once 'Zend/Validate/Hostname.php';
$validate = new Zend_Validate_Hostname();
var_dump($validate->isValid('müller.de'));
var_dump($validate->isValid('xn--mller-kva.de'));
?>

Result:
bool(true)
bool(false)

Expected:
bool(true)
bool(true)

Activity

Hide
Nico Edtinger added a comment -

Task can be assigned to me. Some feedback would be nice.

Show
Nico Edtinger added a comment - Task can be assigned to me. Some feedback would be nice.
Hide
Thomas Weidner added a comment -

Supporting punycode raises some other issues which have to be solved.

One is coding: It has to be checked if the resulting IDN is supported after punycode has been translated.
Second is length: Punycode produces longer strings then IDN which would fail when their length is checked.

I see this not as bug but as improvement as punycode is until now not supported.

Show
Thomas Weidner added a comment - Supporting punycode raises some other issues which have to be solved. One is coding: It has to be checked if the resulting IDN is supported after punycode has been translated. Second is length: Punycode produces longer strings then IDN which would fail when their length is checked. I see this not as bug but as improvement as punycode is until now not supported.
Hide
Thomas Weidner added a comment -

New feature implemented with r14556

Show
Thomas Weidner added a comment - New feature implemented with r14556

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: