Issues

ZF-3570: Zend_Validate_Hostname - lengh check for idn domains incorrect

Issue Type: Bug Created: 2008-07-03T09:46:54.000+0000 Last Updated: 2009-03-21T14:47:07.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Jan Schmidle (mesqualin) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

Related issues: Attachments:

Description

Zend_Validate_Hostname does not validate the length of idn domains correctly.

<pre class="highlight">
$IDN = new Net_IDNA_php5();
$validator = new Zend_Validate_Hostname();
$host = "müslikjmnhjukiüöäüökiöäüökiijhnmjkiüöäimkjnhukääumhnjuikhum123n.de";
$hostascii = $IDN->encode($host);

echo "Domain: $host - length: ".(mb_strlen($host, "utf8")-3)." (without '.de')\n";
echo "Domain: $hostascii - length: ".(mb_strlen($hostascii, "utf8")-3)." (without '.de') \n";

if ($validator->isValid($host)) {
    echo "Hostname OK\n"; 
} else {
    foreach ($validator->getMessages() as $message) echo "$message\n";
}   

results in:

<pre class="literal">
Domain: müslikjmnhjukiüöäüökiöäüökiijhnmjkiüöäimkjnhukääumhnjuikhum123n.de - length: 63 (without '.de'')
Domain: xn--mslikjmnhjukikikiijhnmjkiimkjnhukumhnjuikhum123n-n9dckia16gbacbk73amacfl.de - length: 76 (without '.de') 
Hostname OK

Hostname shouldn't be OK due to its length of 73 chars in Punycode.

Comments

Posted by Thomas Weidner (thomas) on 2009-03-21T14:47:07.000+0000

New feature implemented with the last rework of Zend_Validate_Hostname

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