Issues

ZF-11796: Missing IDN validation for .si domain

Issue Type: Improvement Created: 2011-10-04T06:52:40.000+0000 Last Updated: 2011-10-18T16:00:51.000+0000 Status: Resolved Fix version(s): - 1.11.12 (22/Jun/12)

  • Next Major Release ()

Reporter: Uros (urosgruber) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate

  • zf-caretaker-adamlundrigan

Related issues: Attachments:

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

Posted by Adam Lundrigan (adamlundrigan) on 2011-10-05T15:15:18.000+0000

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:

<pre class="highlight">
/**
 * @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:

<pre class="highlight">
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 <a href="http://www.iana.org/domains/idn-tables/tables/sa_ar_1.0.html">http://iana.org/domains/idn-tables/…</a>
      * (.SE) Sweden <a href="http://www.iis.se/english/IDN_campaignsite.shtml?lang=en">http://iis.se/english/IDN_campaignsite.shtml/…</a>
      * (.SH) Saint Helena <a href="http://www.nic.sh/SH-IDN-Policy.pdf">http://www.nic.sh/SH-IDN-Policy.pdf</a>
+     * (.SI) Slovenia <a href="http://www.register.si/idn/znaki.html">http://www.register.si/idn/znaki.html</a> <a href="http://www.register.si/fileadmin/dokumenti/register/unicode.pdf">http://register.si/fileadmin/dokumenti/…</a>
      * (.SJ) Svalbard and Jan Mayen <a href="http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html">http://norid.no/domeneregistrering/idn/…</a>
      * (.TH) Thailand <a href="http://www.iana.org/domains/idn-tables/tables/th_th-th_1.0.html">http://iana.org/domains/idn-tables/…</a>
      * (.TM) Turkmenistan <a href="http://www.nic.tm/TM-IDN-Policy.pdf">http://www.nic.tm/TM-IDN-Policy.pdf</a>
@@ -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'),

Posted by Thomas Weidner (thomas) on 2011-10-05T18:14:19.000+0000

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

Posted by Thomas Weidner (thomas) on 2011-10-08T06:19:51.000+0000

Added to ZF2 with GH-469

Posted by Adam Lundrigan (adamlundrigan) on 2011-10-17T14:14:26.000+0000

Should this also be committed to ZFv1?

Posted by Thomas Weidner (thomas) on 2011-10-17T19:36:12.000+0000

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

Posted by Adam Lundrigan (adamlundrigan) on 2011-10-18T16:00:51.000+0000

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

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