ZF-11796: Missing IDN validation for .si domain

Description

Zend_Validate does not validate IDN domains for .si. Document for valid chars can be found http://www.register.si/idn/znaki.html Max length for domain is 63 chars and minimum is 2.

Comments

Could you provide a few examples of both valid and invalid .si IDNs which we could use to develop a test of the validator? Here is what I have so far:

Unit test:


/**
 * @group ZF-11796
 */
public function testSupportsInternationalizedSlovenianDomainNames()
{
    $validator = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_DNS);
    $this->assertFalse($validator->isValid('à.si'));  // Too Short
    $this->assertFalse($validator->isValid(str_repeat('à',64) . '.si'));  // Too long
    $this->assertTrue($validator->isValid('àďĝșķĩīĭį.si'));  // Valid
}

Prototype Fix:


Index: library/Zend/Validate/Hostname.php
===================================================================
--- library/Zend/Validate/Hostname.php  (revision 24493)
+++ library/Zend/Validate/Hostname.php  (working copy)
@@ -182,6 +182,7 @@
      * (.SA) Saudi Arabia http://iana.org/domains/idn-tables/…
      * (.SE) Sweden http://iis.se/english/IDN_campaignsite.shtml/…
      * (.SH) Saint Helena http://www.nic.sh/SH-IDN-Policy.pdf
+     * (.SI) Slovenia http://www.register.si/idn/znaki.html http://register.si/fileadmin/dokumenti/…
      * (.SJ) Svalbard and Jan Mayen http://norid.no/domeneregistrering/idn/…
      * (.TH) Thailand http://iana.org/domains/idn-tables/…
      * (.TM) Turkmenistan http://www.nic.tm/TM-IDN-Policy.pdf
@@ -283,6 +284,7 @@
         'SA'  => array(1 => '/^[\x{002d}.0-9\x{0621}-\x{063A}\x{0641}-\x{064A}\x{0660}-\x{0669}]{1,63}$/iu'),
         'SE'  => array(1 => '/^[\x{002d}0-9a-zäåéöü]{1,63}$/iu'),
         'SH'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
+        'SI'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēĕėěęĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżžșț]{2,63}$/iu'),        
         'SJ'  => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'),
         'TH'  => array(1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'),
         'TM'  => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćĉċčďđēėęěĝġģĥħīįĵķĺļľŀłńņňŋőœŕŗřśŝşšţťŧūŭůűųŵŷźżž]{1,63}$/iu'),

Changed from bug to improvement as IDN rules are relativ new for SI domains

Added to ZF2 with GH-469

Should this also be committed to ZFv1?

Feel free to backport. But note that your fix and unit test are incomplete. Please use GH-469 when you want to backport this improvement

Backported GH-469 into ZFv1. Fixed in trunk r24513 Merged to release-1.11 in r24514