1<?php 2 3/* 4 * This file is part of the Symfony package. 5 * 6 * (c) Fabien Potencier <fabien@symfony.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12use Symfony\Polyfill\Intl\Idn as p; 13 14if (!defined('U_IDNA_PROHIBITED_ERROR')) { 15 define('U_IDNA_PROHIBITED_ERROR', 66560); 16} 17if (!defined('U_IDNA_ERROR_START')) { 18 define('U_IDNA_ERROR_START', 66560); 19} 20if (!defined('U_IDNA_UNASSIGNED_ERROR')) { 21 define('U_IDNA_UNASSIGNED_ERROR', 66561); 22} 23if (!defined('U_IDNA_CHECK_BIDI_ERROR')) { 24 define('U_IDNA_CHECK_BIDI_ERROR', 66562); 25} 26if (!defined('U_IDNA_STD3_ASCII_RULES_ERROR')) { 27 define('U_IDNA_STD3_ASCII_RULES_ERROR', 66563); 28} 29if (!defined('U_IDNA_ACE_PREFIX_ERROR')) { 30 define('U_IDNA_ACE_PREFIX_ERROR', 66564); 31} 32if (!defined('U_IDNA_VERIFICATION_ERROR')) { 33 define('U_IDNA_VERIFICATION_ERROR', 66565); 34} 35if (!defined('U_IDNA_LABEL_TOO_LONG_ERROR')) { 36 define('U_IDNA_LABEL_TOO_LONG_ERROR', 66566); 37} 38if (!defined('U_IDNA_ZERO_LENGTH_LABEL_ERROR')) { 39 define('U_IDNA_ZERO_LENGTH_LABEL_ERROR', 66567); 40} 41if (!defined('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR')) { 42 define('U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR', 66568); 43} 44if (!defined('U_IDNA_ERROR_LIMIT')) { 45 define('U_IDNA_ERROR_LIMIT', 66569); 46} 47if (!defined('U_STRINGPREP_PROHIBITED_ERROR')) { 48 define('U_STRINGPREP_PROHIBITED_ERROR', 66560); 49} 50if (!defined('U_STRINGPREP_UNASSIGNED_ERROR')) { 51 define('U_STRINGPREP_UNASSIGNED_ERROR', 66561); 52} 53if (!defined('U_STRINGPREP_CHECK_BIDI_ERROR')) { 54 define('U_STRINGPREP_CHECK_BIDI_ERROR', 66562); 55} 56if (!defined('IDNA_DEFAULT')) { 57 define('IDNA_DEFAULT', 0); 58} 59if (!defined('IDNA_ALLOW_UNASSIGNED')) { 60 define('IDNA_ALLOW_UNASSIGNED', 1); 61} 62if (!defined('IDNA_USE_STD3_RULES')) { 63 define('IDNA_USE_STD3_RULES', 2); 64} 65if (!defined('IDNA_CHECK_BIDI')) { 66 define('IDNA_CHECK_BIDI', 4); 67} 68if (!defined('IDNA_CHECK_CONTEXTJ')) { 69 define('IDNA_CHECK_CONTEXTJ', 8); 70} 71if (!defined('IDNA_NONTRANSITIONAL_TO_ASCII')) { 72 define('IDNA_NONTRANSITIONAL_TO_ASCII', 16); 73} 74if (!defined('IDNA_NONTRANSITIONAL_TO_UNICODE')) { 75 define('IDNA_NONTRANSITIONAL_TO_UNICODE', 32); 76} 77if (!defined('INTL_IDNA_VARIANT_UTS46')) { 78 define('INTL_IDNA_VARIANT_UTS46', 1); 79} 80if (!defined('IDNA_ERROR_EMPTY_LABEL')) { 81 define('IDNA_ERROR_EMPTY_LABEL', 1); 82} 83if (!defined('IDNA_ERROR_LABEL_TOO_LONG')) { 84 define('IDNA_ERROR_LABEL_TOO_LONG', 2); 85} 86if (!defined('IDNA_ERROR_DOMAIN_NAME_TOO_LONG')) { 87 define('IDNA_ERROR_DOMAIN_NAME_TOO_LONG', 4); 88} 89if (!defined('IDNA_ERROR_LEADING_HYPHEN')) { 90 define('IDNA_ERROR_LEADING_HYPHEN', 8); 91} 92if (!defined('IDNA_ERROR_TRAILING_HYPHEN')) { 93 define('IDNA_ERROR_TRAILING_HYPHEN', 16); 94} 95if (!defined('IDNA_ERROR_HYPHEN_3_4')) { 96 define('IDNA_ERROR_HYPHEN_3_4', 32); 97} 98if (!defined('IDNA_ERROR_LEADING_COMBINING_MARK')) { 99 define('IDNA_ERROR_LEADING_COMBINING_MARK', 64); 100} 101if (!defined('IDNA_ERROR_DISALLOWED')) { 102 define('IDNA_ERROR_DISALLOWED', 128); 103} 104if (!defined('IDNA_ERROR_PUNYCODE')) { 105 define('IDNA_ERROR_PUNYCODE', 256); 106} 107if (!defined('IDNA_ERROR_LABEL_HAS_DOT')) { 108 define('IDNA_ERROR_LABEL_HAS_DOT', 512); 109} 110if (!defined('IDNA_ERROR_INVALID_ACE_LABEL')) { 111 define('IDNA_ERROR_INVALID_ACE_LABEL', 1024); 112} 113if (!defined('IDNA_ERROR_BIDI')) { 114 define('IDNA_ERROR_BIDI', 2048); 115} 116if (!defined('IDNA_ERROR_CONTEXTJ')) { 117 define('IDNA_ERROR_CONTEXTJ', 4096); 118} 119 120if (!function_exists('idn_to_ascii')) { 121 function idn_to_ascii(?string $domain, ?int $flags = IDNA_DEFAULT, ?int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false { return p\Idn::idn_to_ascii((string) $domain, (int) $flags, (int) $variant, $idna_info); } 122} 123if (!function_exists('idn_to_utf8')) { 124 function idn_to_utf8(?string $domain, ?int $flags = IDNA_DEFAULT, ?int $variant = INTL_IDNA_VARIANT_UTS46, &$idna_info = null): string|false { return p\Idn::idn_to_utf8((string) $domain, (int) $flags, (int) $variant, $idna_info); } 125} 126