bootstrap.php 4.5 KB

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