diff -r 5a6b6e770365 -r 68c69c656a2c web/lib/Zend/Validate/Hostname.php --- a/web/lib/Zend/Validate/Hostname.php Thu May 07 15:10:09 2015 +0200 +++ b/web/lib/Zend/Validate/Hostname.php Thu May 07 15:16:02 2015 +0200 @@ -14,9 +14,9 @@ * * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Hostname.php 25061 2012-11-02 21:24:09Z rob $ + * @version $Id$ */ /** @@ -41,7 +41,7 @@ * * @category Zend * @package Zend_Validate - * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Validate_Hostname extends Zend_Validate_Abstract @@ -110,30 +110,865 @@ /** * Array of valid top-level-domains * - * @see ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain + * Version 2014112800, Last Updated Fri Nov 28 07:07:01 2014 UTC + * + * @see http://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain * @see http://www.iana.org/domains/root/db/ Official list of supported TLDs * @var array */ protected $_validTlds = array( - 'ac', 'ad', 'ae', 'aero', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar', 'arpa', - 'as', 'asia', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf', 'bg', 'bh', 'bi', - 'biz', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv', 'bw', 'by', 'bz', 'ca', 'cat', 'cc', - 'cd', 'cf', 'cg', 'ch', 'ci', 'ck', 'cl', 'cm', 'cn', 'co', 'com', 'coop', 'cr', 'cu', - 'cv', 'cx', 'cy', 'cz', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'edu', 'ee', 'eg', 'er', - 'es', 'et', 'eu', 'fi', 'fj', 'fk', 'fm', 'fo', 'fr', 'ga', 'gb', 'gd', 'ge', 'gf', 'gg', - 'gh', 'gi', 'gl', 'gm', 'gn', 'gov', 'gp', 'gq', 'gr', 'gs', 'gt', 'gu', 'gw', 'gy', 'hk', - 'hm', 'hn', 'hr', 'ht', 'hu', 'id', 'ie', 'il', 'im', 'in', 'info', 'int', 'io', 'iq', - 'ir', 'is', 'it', 'je', 'jm', 'jo', 'jobs', 'jp', 'ke', 'kg', 'kh', 'ki', 'km', 'kn', 'kp', - 'kr', 'kw', 'ky', 'kz', 'la', 'lb', 'lc', 'li', 'lk', 'lr', 'ls', 'lt', 'lu', 'lv', 'ly', - 'ma', 'mc', 'md', 'me', 'mg', 'mh', 'mil', 'mk', 'ml', 'mm', 'mn', 'mo', 'mobi', 'mp', - 'mq', 'mr', 'ms', 'mt', 'mu', 'museum', 'mv', 'mw', 'mx', 'my', 'mz', 'na', 'name', 'nc', - 'ne', 'net', 'nf', 'ng', 'ni', 'nl', 'no', 'np', 'nr', 'nu', 'nz', 'om', 'org', 'pa', 'pe', - 'pf', 'pg', 'ph', 'pk', 'pl', 'pm', 'pn', 'pr', 'pro', 'ps', 'pt', 'pw', 'py', 'qa', 're', - 'ro', 'rs', 'ru', 'rw', 'sa', 'sb', 'sc', 'sd', 'se', 'sg', 'sh', 'si', 'sj', 'sk', 'sl', - 'sm', 'sn', 'so', 'sr', 'st', 'su', 'sv', 'sy', 'sz', 'tc', 'td', 'tel', 'tf', 'tg', 'th', - 'tj', 'tk', 'tl', 'tm', 'tn', 'to', 'tp', 'tr', 'travel', 'tt', 'tv', 'tw', 'tz', 'ua', - 'ug', 'uk', 'um', 'us', 'uy', 'uz', 'va', 'vc', 've', 'vg', 'vi', 'vn', 'vu', 'wf', 'ws', - 'xxx', 'ye', 'yt', 'yu', 'za', 'zm', 'zw' + 'abogado', + 'ac', + 'academy', + 'accountants', + 'active', + 'actor', + 'ad', + 'ae', + 'aero', + 'af', + 'ag', + 'agency', + 'ai', + 'airforce', + 'al', + 'allfinanz', + 'alsace', + 'am', + 'an', + 'android', + 'ao', + 'aq', + 'ar', + 'archi', + 'army', + 'arpa', + 'as', + 'asia', + 'associates', + 'at', + 'attorney', + 'au', + 'auction', + 'audio', + 'autos', + 'aw', + 'ax', + 'axa', + 'az', + 'ba', + 'band', + 'bar', + 'bargains', + 'bayern', + 'bb', + 'bd', + 'be', + 'beer', + 'berlin', + 'best', + 'bf', + 'bg', + 'bh', + 'bi', + 'bid', + 'bike', + 'bio', + 'biz', + 'bj', + 'black', + 'blackfriday', + 'bloomberg', + 'blue', + 'bm', + 'bmw', + 'bn', + 'bnpparibas', + 'bo', + 'boo', + 'boutique', + 'br', + 'brussels', + 'bs', + 'bt', + 'budapest', + 'build', + 'builders', + 'business', + 'buzz', + 'bv', + 'bw', + 'by', + 'bz', + 'bzh', + 'ca', + 'cab', + 'cal', + 'camera', + 'camp', + 'cancerresearch', + 'capetown', + 'capital', + 'caravan', + 'cards', + 'care', + 'career', + 'careers', + 'casa', + 'cash', + 'cat', + 'catering', + 'cc', + 'cd', + 'center', + 'ceo', + 'cern', + 'cf', + 'cg', + 'ch', + 'channel', + 'cheap', + 'christmas', + 'chrome', + 'church', + 'ci', + 'citic', + 'city', + 'ck', + 'cl', + 'claims', + 'cleaning', + 'click', + 'clinic', + 'clothing', + 'club', + 'cm', + 'cn', + 'co', + 'coach', + 'codes', + 'coffee', + 'college', + 'cologne', + 'com', + 'community', + 'company', + 'computer', + 'condos', + 'construction', + 'consulting', + 'contractors', + 'cooking', + 'cool', + 'coop', + 'country', + 'cr', + 'credit', + 'creditcard', + 'cricket', + 'crs', + 'cruises', + 'cu', + 'cuisinella', + 'cv', + 'cw', + 'cx', + 'cy', + 'cymru', + 'cz', + 'dad', + 'dance', + 'dating', + 'day', + 'de', + 'deals', + 'degree', + 'delivery', + 'democrat', + 'dental', + 'dentist', + 'desi', + 'diamonds', + 'diet', + 'digital', + 'direct', + 'directory', + 'discount', + 'dj', + 'dk', + 'dm', + 'dnp', + 'do', + 'domains', + 'durban', + 'dvag', + 'dz', + 'eat', + 'ec', + 'edu', + 'education', + 'ee', + 'eg', + 'email', + 'emerck', + 'energy', + 'engineer', + 'engineering', + 'enterprises', + 'equipment', + 'er', + 'es', + 'esq', + 'estate', + 'et', + 'eu', + 'eus', + 'events', + 'everbank', + 'exchange', + 'expert', + 'exposed', + 'fail', + 'farm', + 'feedback', + 'fi', + 'finance', + 'financial', + 'firmdale', + 'fish', + 'fishing', + 'fitness', + 'fj', + 'fk', + 'flights', + 'florist', + 'flsmidth', + 'fly', + 'fm', + 'fo', + 'foo', + 'forsale', + 'foundation', + 'fr', + 'frl', + 'frogans', + 'fund', + 'furniture', + 'futbol', + 'ga', + 'gal', + 'gallery', + 'gb', + 'gbiz', + 'gd', + 'ge', + 'gent', + 'gf', + 'gg', + 'gh', + 'gi', + 'gift', + 'gifts', + 'gives', + 'gl', + 'glass', + 'gle', + 'global', + 'globo', + 'gm', + 'gmail', + 'gmo', + 'gmx', + 'gn', + 'google', + 'gop', + 'gov', + 'gp', + 'gq', + 'gr', + 'graphics', + 'gratis', + 'green', + 'gripe', + 'gs', + 'gt', + 'gu', + 'guide', + 'guitars', + 'guru', + 'gw', + 'gy', + 'hamburg', + 'haus', + 'healthcare', + 'help', + 'here', + 'hiphop', + 'hiv', + 'hk', + 'hm', + 'hn', + 'holdings', + 'holiday', + 'homes', + 'horse', + 'host', + 'hosting', + 'house', + 'how', + 'hr', + 'ht', + 'hu', + 'ibm', + 'id', + 'ie', + 'il', + 'im', + 'immo', + 'immobilien', + 'in', + 'industries', + 'info', + 'ing', + 'ink', + 'institute', + 'insure', + 'int', + 'international', + 'investments', + 'io', + 'iq', + 'ir', + 'is', + 'it', + 'je', + 'jetzt', + 'jm', + 'jo', + 'jobs', + 'joburg', + 'jp', + 'juegos', + 'kaufen', + 'ke', + 'kg', + 'kh', + 'ki', + 'kim', + 'kitchen', + 'kiwi', + 'km', + 'kn', + 'koeln', + 'kp', + 'kr', + 'krd', + 'kred', + 'kw', + 'ky', + 'kz', + 'la', + 'lacaixa', + 'land', + 'lawyer', + 'lb', + 'lc', + 'lds', + 'lease', + 'legal', + 'lgbt', + 'li', + 'life', + 'lighting', + 'limited', + 'limo', + 'link', + 'lk', + 'loans', + 'london', + 'lotto', + 'lr', + 'ls', + 'lt', + 'ltda', + 'lu', + 'luxe', + 'luxury', + 'lv', + 'ly', + 'ma', + 'madrid', + 'maison', + 'management', + 'mango', + 'market', + 'marketing', + 'mc', + 'md', + 'me', + 'media', + 'meet', + 'melbourne', + 'meme', + 'memorial', + 'menu', + 'mg', + 'mh', + 'miami', + 'mil', + 'mini', + 'mk', + 'ml', + 'mm', + 'mn', + 'mo', + 'mobi', + 'moda', + 'moe', + 'monash', + 'money', + 'mormon', + 'mortgage', + 'moscow', + 'motorcycles', + 'mov', + 'mp', + 'mq', + 'mr', + 'ms', + 'mt', + 'mu', + 'museum', + 'mv', + 'mw', + 'mx', + 'my', + 'mz', + 'na', + 'nagoya', + 'name', + 'navy', + 'nc', + 'ne', + 'net', + 'network', + 'neustar', + 'new', + 'nexus', + 'nf', + 'ng', + 'ngo', + 'nhk', + 'ni', + 'ninja', + 'nl', + 'no', + 'np', + 'nr', + 'nra', + 'nrw', + 'nu', + 'nyc', + 'nz', + 'okinawa', + 'om', + 'ong', + 'onl', + 'ooo', + 'org', + 'organic', + 'otsuka', + 'ovh', + 'pa', + 'paris', + 'partners', + 'parts', + 'party', + 'pe', + 'pf', + 'pg', + 'ph', + 'pharmacy', + 'photo', + 'photography', + 'photos', + 'physio', + 'pics', + 'pictures', + 'pink', + 'pizza', + 'pk', + 'pl', + 'place', + 'plumbing', + 'pm', + 'pn', + 'pohl', + 'poker', + 'post', + 'pr', + 'praxi', + 'press', + 'pro', + 'prod', + 'productions', + 'prof', + 'properties', + 'property', + 'ps', + 'pt', + 'pub', + 'pw', + 'py', + 'qa', + 'qpon', + 'quebec', + 're', + 'realtor', + 'recipes', + 'red', + 'rehab', + 'reise', + 'reisen', + 'reit', + 'ren', + 'rentals', + 'repair', + 'report', + 'republican', + 'rest', + 'restaurant', + 'reviews', + 'rich', + 'rio', + 'rip', + 'ro', + 'rocks', + 'rodeo', + 'rs', + 'rsvp', + 'ru', + 'ruhr', + 'rw', + 'ryukyu', + 'sa', + 'saarland', + 'sarl', + 'sb', + 'sc', + 'sca', + 'scb', + 'schmidt', + 'schule', + 'science', + 'scot', + 'sd', + 'se', + 'services', + 'sexy', + 'sg', + 'sh', + 'shiksha', + 'shoes', + 'si', + 'singles', + 'sj', + 'sk', + 'sl', + 'sm', + 'sn', + 'so', + 'social', + 'software', + 'sohu', + 'solar', + 'solutions', + 'soy', + 'space', + 'spiegel', + 'sr', + 'st', + 'su', + 'supplies', + 'supply', + 'support', + 'surf', + 'surgery', + 'suzuki', + 'sv', + 'sx', + 'sy', + 'sydney', + 'systems', + 'sz', + 'taipei', + 'tatar', + 'tattoo', + 'tax', + 'tc', + 'td', + 'technology', + 'tel', + 'tf', + 'tg', + 'th', + 'tienda', + 'tips', + 'tirol', + 'tj', + 'tk', + 'tl', + 'tm', + 'tn', + 'to', + 'today', + 'tokyo', + 'tools', + 'top', + 'town', + 'toys', + 'tp', + 'tr', + 'trade', + 'training', + 'travel', + 'tt', + 'tui', + 'tv', + 'tw', + 'tz', + 'ua', + 'ug', + 'uk', + 'university', + 'uno', + 'uol', + 'us', + 'uy', + 'uz', + 'va', + 'vacations', + 'vc', + 've', + 'vegas', + 'ventures', + 'versicherung', + 'vet', + 'vg', + 'vi', + 'viajes', + 'villas', + 'vision', + 'vlaanderen', + 'vn', + 'vodka', + 'vote', + 'voting', + 'voto', + 'voyage', + 'vu', + 'wales', + 'wang', + 'watch', + 'webcam', + 'website', + 'wed', + 'wedding', + 'wf', + 'whoswho', + 'wien', + 'wiki', + 'williamhill', + 'wme', + 'work', + 'works', + 'world', + 'ws', + 'wtc', + 'wtf', + 'xn--1qqw23a', + 'xn--3bst00m', + 'xn--3ds443g', + 'xn--3e0b707e', + 'xn--45brj9c', + 'xn--45q11c', + 'xn--4gbrim', + 'xn--55qw42g', + 'xn--55qx5d', + 'xn--6frz82g', + 'xn--6qq986b3xl', + 'xn--80adxhks', + 'xn--80ao21a', + 'xn--80asehdb', + 'xn--80aswg', + 'xn--90a3ac', + 'xn--c1avg', + 'xn--cg4bki', + 'xn--clchc0ea0b2g2a9gcd', + 'xn--czr694b', + 'xn--czru2d', + 'xn--d1acj3b', + 'xn--d1alf', + 'xn--fiq228c5hs', + 'xn--fiq64b', + 'xn--fiqs8s', + 'xn--fiqz9s', + 'xn--flw351e', + 'xn--fpcrj9c3d', + 'xn--fzc2c9e2c', + 'xn--gecrj9c', + 'xn--h2brj9c', + 'xn--i1b6b1a6a2e', + 'xn--io0a7i', + 'xn--j1amh', + 'xn--j6w193g', + 'xn--kprw13d', + 'xn--kpry57d', + 'xn--kput3i', + 'xn--l1acc', + 'xn--lgbbat1ad8j', + 'xn--mgb9awbf', + 'xn--mgba3a4f16a', + 'xn--mgbaam7a8h', + 'xn--mgbab2bd', + 'xn--mgbayh7gpa', + 'xn--mgbbh1a71e', + 'xn--mgbc0a9azcg', + 'xn--mgberp4a5d4ar', + 'xn--mgbx4cd0ab', + 'xn--ngbc5azd', + 'xn--node', + 'xn--nqv7f', + 'xn--nqv7fs00ema', + 'xn--o3cw4h', + 'xn--ogbpf8fl', + 'xn--p1acf', + 'xn--p1ai', + 'xn--pgbs0dh', + 'xn--q9jyb4c', + 'xn--qcka1pmc', + 'xn--rhqv96g', + 'xn--s9brj9c', + 'xn--ses554g', + 'xn--unup4y', + 'xn--vermgensberater-ctb', + 'xn--vermgensberatung-pwb', + 'xn--vhquv', + 'xn--wgbh1c', + 'xn--wgbl6a', + 'xn--xhq521b', + 'xn--xkc2al3hye2a', + 'xn--xkc2dl3a5ee0h', + 'xn--yfro4i67o', + 'xn--ygbi2ammx', + 'xn--zfr164b', + 'xxx', + 'xyz', + 'yachts', + 'yandex', + 'ye', + 'yoga', + 'yokohama', + 'youtube', + 'yt', + 'za', + 'zip', + 'zm', + 'zone', + 'zw', + '测试', + 'परीक्षा', + '佛山', + '集团', + '在线', + '한국', + 'ভারত', + '八卦', + 'موقع', + 'বাংলা', + '公益', + '公司', + '移动', + '我爱你', + 'москва', + 'испытание', + 'қаз', + 'онлайн', + 'сайт', + 'срб', + 'бел', + '테스트', + 'орг', + '삼성', + 'சிங்கப்பூர்', + '商标', + '商城', + 'дети', + 'мкд', + 'טעסט', + '中文网', + '中信', + '中国', + '中國', + '谷歌', + 'భారత్', + 'ලංකා', + '測試', + 'ભારત', + 'भारत', + 'آزمایشی', + 'பரிட்சை', + 'संगठन', + '网络', + 'укр', + '香港', + 'δοκιμή', + 'إختبار', + '台湾', + '台灣', + '手机', + 'мон', + 'الجزائر', + 'عمان', + 'ایران', + 'امارات', + 'بازار', + 'پاکستان', + 'الاردن', + 'بھارت', + 'المغرب', + 'السعودية', + 'سودان', + 'عراق', + 'مليسيا', + 'شبكة', + 'გე', + '机构', + '组织机构', + 'ไทย', + 'سورية', + 'рус', + 'рф', + 'تونس', + 'みんな', + 'グーグル', + '世界', + 'ਭਾਰਤ', + '网址', + '游戏', + 'vermögensberater', + 'vermögensberatung', + '企业', + 'مصر', + 'قطر', + '广东', + 'இலங்கை', + 'இந்தியா', + 'հայ', + '新加坡', + 'فلسطين', + 'テスト', + '政务', ); /** @@ -151,6 +986,7 @@ * (.BIZ) International http://www.iana.org/domains/idn-tables/ * (.BR) Brazil http://registro.br/faq/faq6.html * (.BV) Bouvett Island http://www.norid.no/domeneregistrering/idn/idn_nyetegn.en.html + * (.CA) Canada http://www.iana.org/domains/idn-tables/tables/ca_fr_1.0.html * (.CAT) Catalan http://www.iana.org/domains/idn-tables/tables/cat_ca_1.0.html * (.CH) Switzerland https://nic.switch.ch/reg/ocView.action?res=EF6GW2JBPVTG67DLNIQXU234MN6SC33JNQQGI7L6#anhang1 * (.CL) Chile http://www.iana.org/domains/idn-tables/tables/cl_latn_1.0.html @@ -179,6 +1015,7 @@ * (.PR) Puerto Rico http://www.nic.pr/idn_rules.asp * (.PT) Portugal https://online.dns.pt/dns_2008/do?com=DS;8216320233;111;+PAGE(4000058)+K-CAT-CODIGO(C.125)+RCNT(100); * (.RU) Russia http://www.iana.org/domains/idn-tables/tables/ru_ru-ru_1.0.html + * (.RS) Serbia http://www.iana.org/domains/idn-tables/tables/rs_sr-rs_1.0.pdf * (.SA) Saudi Arabia http://www.iana.org/domains/idn-tables/tables/sa_ar_1.0.html * (.SE) Sweden http://www.iis.se/english/IDN_campaignsite.shtml?lang=en * (.SH) Saint Helena http://www.nic.sh/SH-IDN-Policy.pdf @@ -186,6 +1023,7 @@ * (.TH) Thailand http://www.iana.org/domains/idn-tables/tables/th_th-th_1.0.html * (.TM) Turkmenistan http://www.nic.tm/TM-IDN-Policy.pdf * (.TR) Turkey https://www.nic.tr/index.php + * (.UA) Ukraine http://www.iana.org/domains/idn-tables/tables/ua_cyrl_1.2.html * (.VE) Venice http://www.iana.org/domains/idn-tables/tables/ve_es_1.0.html * (.VN) Vietnam http://www.vnnic.vn/english/5-6-300-2-2-04-20071115.htm#1.%20Introduction * @@ -199,11 +1037,12 @@ 'BIZ' => 'Hostname/Biz.php', 'BR' => array(1 => '/^[\x{002d}0-9a-zà-ãçéíó-õúü]{1,63}$/iu'), 'BV' => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'), + 'CA' => array(1 => '/^[\x{002d}0-9a-zàâæçéèêëîïôœùûüÿ\x{00E0}\x{00E2}\x{00E7}\x{00E8}\x{00E9}\x{00EA}\x{00EB}\x{00EE}\x{00EF}\x{00F4}\x{00F9}\x{00FB}\x{00FC}\x{00E6}\x{0153}\x{00FF}]{1,63}$/iu'), 'CAT' => array(1 => '/^[\x{002d}0-9a-z·àç-éíïòóúü]{1,63}$/iu'), 'CH' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'), 'CL' => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'), 'CN' => 'Hostname/Cn.php', - 'COM' => 'Zend/Validate/Hostname/Com.php', + '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'), 'ES' => array(1 => '/^[\x{002d}0-9a-zàáçèéíïñòóúü·]{1,63}$/iu'), @@ -212,11 +1051,13 @@ 3 => '/^[\x{002d}0-9a-zșț]{1,63}$/iu', 4 => '/^[\x{002d}0-9a-zΐάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ]{1,63}$/iu', 5 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюя]{1,63}$/iu', - 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu'), + 6 => '/^[\x{002d}0-9a-zἀ-ἇἐ-ἕἠ-ἧἰ-ἷὀ-ὅὐ-ὗὠ-ὧὰ-ὼώᾀ-ᾇᾐ-ᾗᾠ-ᾧᾰ-ᾴᾶᾷῂῃῄῆῇῐ-ῒΐῖῗῠ-ῧῲῳῴῶῷ]{1,63}$/iu'), 'FI' => array(1 => '/^[\x{002d}0-9a-zäåö]{1,63}$/iu'), 'GR' => array(1 => '/^[\x{002d}0-9a-zΆΈΉΊΌΎ-ΡΣ-ώἀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼῂῃῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲῳῴῶ-ῼ]{1,63}$/iu'), - 'HK' => 'Zend/Validate/Hostname/Cn.php', + 'HK' => 'Hostname/Cn.php', 'HU' => array(1 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu'), + 'IL' => array(1 => '/^[\x{002d}0-9\x{05D0}-\x{05EA}]{1,63}$/iu', + 2 => '/^[\x{002d}0-9a-z]{1,63}$/i'), 'INFO'=> array(1 => '/^[\x{002d}0-9a-zäåæéöøü]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-záéíóöúüőű]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-záæéíðóöúýþ]{1,63}$/iu', @@ -227,15 +1068,16 @@ 8 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu'), 'IO' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿăąāćĉčċďđĕěėęēğĝġģĥħĭĩįīıĵķĺľļłńňņŋŏőōœĸŕřŗśŝšşťţŧŭůűũųūŵŷźžż]{1,63}$/iu'), 'IS' => array(1 => '/^[\x{002d}0-9a-záéýúíóþæöð]{1,63}$/iu'), - 'JP' => 'Zend/Validate/Hostname/Jp.php', + 'IT' => array(1 => '/^[\x{002d}0-9a-zàâäèéêëìîïòôöùûüæœçÿß-]{1,63}$/iu'), + 'JP' => 'Hostname/Jp.php', 'KR' => array(1 => '/^[\x{AC00}-\x{D7A3}]{1,17}$/iu'), 'LI' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿœ]{1,63}$/iu'), 'LT' => array(1 => '/^[\x{002d}0-9ąčęėįšųūž]{1,63}$/iu'), 'MD' => array(1 => '/^[\x{002d}0-9ăâîşţ]{1,63}$/iu'), 'MUSEUM' => array(1 => '/^[\x{002d}0-9a-zà-öø-ÿāăąćċčďđēėęěğġģħīįıķĺļľłńņňŋōőœŕŗřśşšţťŧūůűųŵŷźżžǎǐǒǔ\x{01E5}\x{01E7}\x{01E9}\x{01EF}ə\x{0292}ẁẃẅỳ]{1,63}$/iu'), - 'NET' => 'Zend/Validate/Hostname/Com.php', + 'NET' => 'Hostname/Com.php', 'NO' => array(1 => '/^[\x{002d}0-9a-zàáä-éêñ-ôöøüčđńŋšŧž]{1,63}$/iu'), - 'NU' => 'Zend/Validate/Hostname/Com.php', + 'NU' => 'Hostname/Com.php', 'ORG' => array(1 => '/^[\x{002d}0-9a-záéíñóúü]{1,63}$/iu', 2 => '/^[\x{002d}0-9a-zóąćęłńśźż]{1,63}$/iu', 3 => '/^[\x{002d}0-9a-záäåæéëíðóöøúüýþ]{1,63}$/iu', @@ -279,6 +1121,7 @@ 33=> '/^[\x{002d}0-9א-ת]{1,63}$/iu'), 'PR' => array(1 => '/^[\x{002d}0-9a-záéíóúñäëïüöâêîôûàèùæçœãõ]{1,63}$/iu'), 'PT' => array(1 => '/^[\x{002d}0-9a-záàâãçéêíóôõú]{1,63}$/iu'), + 'RS' => array(1 => '/^[\x{002D}\x{0030}-\x{0039}\x{0061}-\x{007A}\x{0107}\x{010D}\x{0111}\x{0161}\x{017E}]{1,63}$/iu)'), 'RU' => array(1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'), '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'), @@ -290,14 +1133,31 @@ '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'), - 'TW' => 'Zend/Validate/Hostname/Cn.php', + 'TW' => 'Hostname/Cn.php', 'TR' => array(1 => '/^[\x{002d}0-9a-zğıüşöç]{1,63}$/iu'), + 'UA' => array(1 => '/^[\x{002d}0-9a-zабвгдежзийклмнопрстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџґӂʼ]{1,63}$/iu'), 'VE' => array(1 => '/^[\x{002d}0-9a-záéíóúüñ]{1,63}$/iu'), 'VN' => array(1 => '/^[ÀÁÂÃÈÉÊÌÍÒÓÔÕÙÚÝàáâãèéêìíòóôõùúýĂăĐđĨĩŨũƠơƯư\x{1EA0}-\x{1EF9}]{1,63}$/iu'), - 'ایران' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), - '中国' => 'Zend/Validate/Hostname/Cn.php', - '公司' => 'Zend/Validate/Hostname/Cn.php', - '网络' => 'Zend/Validate/Hostname/Cn.php' + 'мон' => array(1 => '/^[\x{002d}0-9\x{0430}-\x{044F}]{1,63}$/iu'), + 'срб' => array(1 => '/^[\x{002d}0-9а-ик-шђјљњћџ]{1,63}$/iu'), + 'сайт' => array(1 => '/^[\x{002d}0-9а-яёіїѝйўґг]{1,63}$/iu'), + 'онлайн' => array(1 => '/^[\x{002d}0-9а-яёіїѝйўґг]{1,63}$/iu'), + '中国' => 'Hostname/Cn.php', + '中國' => 'Hostname/Cn.php', + 'ලංකා' => array(1 => '/^[\x{0d80}-\x{0dff}]{1,63}$/iu'), + '香港' => 'Hostname/Cn.php', + '台湾' => 'Hostname/Cn.php', + '台灣' => 'Hostname/Cn.php', + 'امارات' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), + 'الاردن' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), + 'السعودية' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), + 'ไทย' => array(1 => '/^[\x{002d}0-9a-z\x{0E01}-\x{0E3A}\x{0E40}-\x{0E4D}\x{0E50}-\x{0E59}]{1,63}$/iu'), + 'рф' => array(1 => '/^[\x{002d}0-9а-яё]{1,63}$/iu'), + 'تونس' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), + 'مصر' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), + 'இலங்கை' => array(1 => '/^[\x{0b80}-\x{0bff}]{1,63}$/iu'), + 'فلسطين' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), + 'شبكة' => array(1 => '/^[\x{0621}-\x{0624}\x{0626}-\x{063A}\x{0641}\x{0642}\x{0644}-\x{0648}\x{067E}\x{0686}\x{0698}\x{06A9}\x{06AF}\x{06CC}\x{06F0}-\x{06F9}]{1,30}$/iu'), ); protected $_idnLength = array( @@ -326,12 +1186,8 @@ /** * Sets validator options * - * @param integer $allow OPTIONAL Set what types of hostname to allow (default ALLOW_DNS) - * @param boolean $validateIdn OPTIONAL Set whether IDN domains are validated (default true) - * @param boolean $validateTld OPTIONAL Set whether the TLD element of a hostname is validated (default true) - * @param Zend_Validate_Ip $ipValidator OPTIONAL - * @return void * @see http://www.iana.org/cctld/specifications-policies-cctlds-01apr02.htm Technical Specifications for ccTLDs + * @param array $options Validator options */ public function __construct($options = array()) { @@ -408,7 +1264,7 @@ /** * @param Zend_Validate_Ip $ipValidator OPTIONAL - * @return void; + * @return Zend_Validate_Hostname */ public function setIpValidator(Zend_Validate_Ip $ipValidator = null) { @@ -458,6 +1314,7 @@ * This only applies when DNS hostnames are validated * * @param boolean $allowed Set allowed to true to validate IDNs, and false to not validate them + * @return $this */ public function setValidateIdn ($allowed) { @@ -481,6 +1338,7 @@ * This only applies when DNS hostnames are validated * * @param boolean $allowed Set allowed to true to validate TLDs, and false to not validate them + * @return $this */ public function setValidateTld ($allowed) { @@ -517,14 +1375,14 @@ } // RFC3986 3.2.2 states: - // + // // The rightmost domain label of a fully qualified domain name - // in DNS may be followed by a single "." and should be if it is + // in DNS may be followed by a single "." and should be if it is // necessary to distinguish between the complete domain name and // some local domain. - // + // // (see ZF-6363) - + // Local hostnames are allowed to be partitial (ending '.') if ($this->_options['allow'] & self::ALLOW_LOCAL) { if (substr($value, -1) === '.') { @@ -549,15 +1407,19 @@ if ((count($domainParts) > 1) && (strlen($value) >= 4) && (strlen($value) <= 254)) { $status = false; - $origenc = iconv_get_encoding('internal_encoding'); - iconv_set_encoding('internal_encoding', 'UTF-8'); + $origenc = PHP_VERSION_ID < 50600 + ? iconv_get_encoding('internal_encoding') + : ini_get('default_charset'); + if (PHP_VERSION_ID < 50600) { + iconv_set_encoding('internal_encoding', 'UTF-8'); + } else { + ini_set('default_charset', 'UTF-8'); + } do { // First check TLD $matches = array(); - if (preg_match('/([^.]{2,10})$/i', end($domainParts), $matches) || - (end($domainParts) == 'ایران') || (end($domainParts) == '中国') || - (end($domainParts) == '公司') || (end($domainParts) == '网络')) { - + if (preg_match('/([^.]{2,63})$/iu', end($domainParts), $matches) + || (array_key_exists(end($domainParts), $this->_validIdns))) { reset($domainParts); // Hostname characters are: *(label dot)(label dot label); max 254 chars @@ -566,13 +1428,17 @@ // ldh: alpha / digit / dash // Match TLD against known list - $this->_tld = strtolower($matches[1]); + $this->_tld = $matches[1]; if ($this->_options['tld']) { - if (!in_array($this->_tld, $this->_validTlds)) { + if (!in_array(strtolower($this->_tld), $this->_validTlds) + && !in_array($this->_tld, $this->_validTlds)) { $this->_error(self::UNKNOWN_TLD); $status = false; break; } + // We have already validated that the TLD is fine. We don't want it to go through the below + // checks as new UTF-8 TLDs will incorrectly fail if there is no IDN regex for it. + array_pop($domainParts); } /** @@ -592,6 +1458,12 @@ // Check each hostname part $check = 0; foreach ($domainParts as $domainPart) { + // If some domain part is empty (i.e. zend..com), it's invalid + if (empty($domainPart)) { + $this->_error(self::INVALID_HOSTNAME); + return false; + } + // Decode Punycode domainnames to IDN if (strpos($domainPart, 'xn--') === 0) { $domainPart = $this->decodePunycode(substr($domainPart, 4)); @@ -612,7 +1484,7 @@ // Check each domain part $checked = false; foreach($regexChars as $regexKey => $regexChar) { - $status = @preg_match($regexChar, $domainPart); + $status = preg_match($regexChar, $domainPart); if ($status > 0) { $length = 63; if (array_key_exists(strtoupper($this->_tld), $this->_idnLength) @@ -646,7 +1518,11 @@ } } while (false); - iconv_set_encoding('internal_encoding', $origenc); + if (PHP_VERSION_ID < 50600) { + iconv_set_encoding('internal_encoding', $origenc); + } else { + ini_set('default_charset', $origenc); + } // If the input passes as an Internet domain name, and domain names are allowed, then the hostname // passes validation if ($status && ($this->_options['allow'] & self::ALLOW_DNS)) { @@ -698,22 +1574,19 @@ */ protected function decodePunycode($encoded) { - $found = preg_match('/([^a-z0-9\x2d]{1,10})$/i', $encoded); - if (empty($encoded) || ($found > 0)) { - // no punycode encoded string, return as is + if (!preg_match('/^[a-z0-9-]+$/i', $encoded)) { + // no punycode encoded string $this->_error(self::CANNOT_DECODE_PUNYCODE); return false; } + $decoded = array(); $separator = strrpos($encoded, '-'); if ($separator > 0) { for ($x = 0; $x < $separator; ++$x) { // prepare decoding matrix $decoded[] = ord($encoded[$x]); } - } else { - $this->_error(self::CANNOT_DECODE_PUNYCODE); - return false; } $lengthd = count($decoded);