Skip to content

Commit

Permalink
Merge branch 'hotfix/zendframework#7150-estonian-idn-and-fixed-binary…
Browse files Browse the repository at this point in the history
…-code-for-host-dns-regname' into develop

Close zendframework#7150
Forward port zendframework#7150
  • Loading branch information
Ocramius committed Feb 2, 2015
2 parents 5aed8a9 + dc8a815 commit 7cd9524
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
24 changes: 12 additions & 12 deletions library/Zend/Uri/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ class Uri implements UriInterface
* Place 1 or 0 in the different positions for enable or disable the part.
* Finally use a hexadecimal representation.
*/
const HOST_IPV4 = 0x01; //00001
const HOST_IPV6 = 0x02; //00010
const HOST_IPVFUTURE = 0x04; //00100
const HOST_IPVANY = 0x07; //00111
const HOST_DNS = 0x08; //01000
const HOST_DNS_OR_IPV4 = 0x09; //01001
const HOST_DNS_OR_IPV6 = 0x0A; //01010
const HOST_DNS_OR_IPV4_OR_IPV6 = 0x0B; //01011
const HOST_DNS_OR_IPVANY = 0x0F; //01111
const HOST_REGNAME = 0x10; //10000
const HOST_DNS_OR_IPV4_OR_IPV6_OR_REGNAME = 0x13; //10011
const HOST_ALL = 0x1F; //11111
const HOST_IPV4 = 0x01; //00001
const HOST_IPV6 = 0x02; //00010
const HOST_IPVFUTURE = 0x04; //00100
const HOST_IPVANY = 0x07; //00111
const HOST_DNS = 0x08; //01000
const HOST_DNS_OR_IPV4 = 0x09; //01001
const HOST_DNS_OR_IPV6 = 0x0A; //01010
const HOST_DNS_OR_IPV4_OR_IPV6 = 0x0B; //01011
const HOST_DNS_OR_IPVANY = 0x0F; //01111
const HOST_REGNAME = 0x10; //10000
const HOST_DNS_OR_IPV4_OR_IPV6_OR_REGNAME = 0x1B; //11011
const HOST_ALL = 0x1F; //11111

/**
* URI scheme
Expand Down
2 changes: 2 additions & 0 deletions library/Zend/Validator/Hostname.php
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ class Hostname extends AbstractValidator
* (.COM) International http://www.verisign.com/information-services/naming-services/internationalized-domain-names/index.html
* (.DE) Germany http://www.denic.de/en/domains/idns/liste.html
* (.DK) Danmark http://www.dk-hostmaster.dk/index.php?id=151
* (.EE) Estonia https://www.iana.org/domains/idn-tables/tables/pl_et-pl_1.0.html
* (.ES) Spain https://www.nic.es/media/2008-05/1210147705287.pdf
* (.FI) Finland http://www.ficora.fi/en/index/palvelut/fiverkkotunnukset/aakkostenkaytto.html
* (.GR) Greece https://grweb.ics.forth.gr/CharacterTable1_en.jsp
Expand Down Expand Up @@ -894,6 +895,7 @@ class Hostname extends AbstractValidator
'COM' => 'Hostname/Com.php',
'DE' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'),
'DK' => array(1 => '/^[\x{002d}0-9a-zäéöü]{1,63}$/iu'),
'EE' => array(1 => '/^[\x{002d}0-9a-zäõöüšž]{1,63}$/iu'),
'ES' => array(1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'),
'EU' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿ]{1,63}$/iu',
2 => '/^[\x{002d}0-9a-zāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįıĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝšťŧũūŭůűųŵŷźżž]{1,63}$/iu',
Expand Down
1 change: 1 addition & 0 deletions tests/ZendTest/Uri/HttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function validHostProvider()
array('http://www.example.org/', false),
array('www.example.org:80', false),
array('www.example.org', true),
array('plekitööd.ee', true),
array('http://foo', false),
array('foo', true),
array('ftp://user:[email protected]/', false),
Expand Down
4 changes: 2 additions & 2 deletions tests/ZendTest/Validator/HostnameTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ public function testResourceIDN()

// Check IDN matching
$valuesExpected = array(
array(true, array('bürger.com', 'hãllo.com', 'hållo.com')),
array(true, array('bÜrger.com', 'hÃllo.com', 'hÅllo.com')),
array(true, array('bürger.com', 'hãllo.com', 'hållo.com', 'plekitööd.ee')),
array(true, array('bÜrger.com', 'hÃllo.com', 'hÅllo.com', 'plekitÖÖd.ee')),
array(false, array('hãllo.lt', 'bürger.lt', 'hãllo.lt'))
);
foreach ($valuesExpected as $element) {
Expand Down

0 comments on commit 7cd9524

Please sign in to comment.