Update to laravel 7

This commit is contained in:
KodeStar
2022-03-10 11:54:29 +00:00
parent 61a5a1a8b0
commit f9a19fce91
7170 changed files with 274189 additions and 283773 deletions

View File

@@ -36,14 +36,14 @@ namespace Symfony\Polyfill\Iconv;
*/
final class Iconv
{
const ERROR_ILLEGAL_CHARACTER = 'iconv(): Detected an illegal character in input string';
const ERROR_WRONG_CHARSET = 'iconv(): Wrong charset, conversion from `%s\' to `%s\' is not allowed';
public const ERROR_ILLEGAL_CHARACTER = 'iconv(): Detected an illegal character in input string';
public const ERROR_WRONG_CHARSET = 'iconv(): Wrong charset, conversion from `%s\' to `%s\' is not allowed';
public static $inputEncoding = 'utf-8';
public static $outputEncoding = 'utf-8';
public static $internalEncoding = 'utf-8';
private static $alias = array(
private static $alias = [
'utf8' => 'utf-8',
'ascii' => 'us-ascii',
'tis-620' => 'iso-8859-11',
@@ -116,13 +116,13 @@ final class Iconv
'iso885914' => 'iso-8859-14',
'iso885915' => 'iso-8859-15',
'iso885916' => 'iso-8859-16',
);
private static $translitMap = array();
private static $convertMap = array();
];
private static $translitMap = [];
private static $convertMap = [];
private static $errorHandler;
private static $lastError;
private static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
private static $isValidUtf8;
public static function iconv($inCharset, $outCharset, $str)
@@ -238,7 +238,7 @@ final class Iconv
}
$str = explode("\n\n", $str, 2);
$headers = array();
$headers = [];
$str = preg_split('/\n(?![ \t])/', $str[0]);
foreach ($str as $str) {
@@ -251,7 +251,7 @@ final class Iconv
if (2 === \count($str)) {
if (isset($headers[$str[0]])) {
if (!\is_array($headers[$str[0]])) {
$headers[$str[0]] = array($headers[$str[0]]);
$headers[$str[0]] = [$headers[$str[0]]];
}
$headers[$str[0]][] = ltrim($str[1]);
} else {
@@ -268,7 +268,7 @@ final class Iconv
if (null === $charset) {
$charset = self::$internalEncoding;
}
if (ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) {
if (\ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) {
$charset .= '//IGNORE';
}
@@ -277,7 +277,7 @@ final class Iconv
}
$str = preg_split('/\n(?![ \t])/', rtrim($str), 2);
$str = preg_replace('/[ \t]*\n[ \t]+/', ' ', rtrim($str[0]));
$str = preg_split('/=\?([^?]+)\?([bqBQ])\?(.*?)\?=/', $str, -1, PREG_SPLIT_DELIM_CAPTURE);
$str = preg_split('/=\?([^?]+)\?([bqBQ])\?(.*?)\?=/', $str, -1, \PREG_SPLIT_DELIM_CAPTURE);
$result = self::iconv('utf-8', $charset, $str[0]);
if (false === $result) {
@@ -289,7 +289,7 @@ final class Iconv
while ($i < $len) {
$c = strtolower($str[$i]);
if ((ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode)
if ((\ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode)
&& 'utf-8' !== $c
&& !isset(self::$alias[$c])
&& !self::loadMap('from.', $c, $d)) {
@@ -312,7 +312,7 @@ final class Iconv
if ('' !== trim($d)) {
$result .= $d;
}
} elseif (ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) {
} elseif (\ICONV_MIME_DECODE_CONTINUE_ON_ERROR & $mode) {
$result .= "=?{$str[$i]}?{$str[$i + 1]}?{$str[$i + 2]}?={$str[$i + 3]}";
} else {
$result = false;
@@ -333,11 +333,11 @@ final class Iconv
case 'internal_encoding': return self::$internalEncoding;
}
return array(
return [
'input_encoding' => self::$inputEncoding,
'output_encoding' => self::$outputEncoding,
'internal_encoding' => self::$internalEncoding,
);
];
}
public static function iconv_set_encoding($type, $charset)
@@ -346,7 +346,6 @@ final class Iconv
case 'input_encoding': self::$inputEncoding = $charset; break;
case 'output_encoding': self::$outputEncoding = $charset; break;
case 'internal_encoding': self::$internalEncoding = $charset; break;
default: return false;
}
@@ -356,16 +355,16 @@ final class Iconv
public static function iconv_mime_encode($fieldName, $fieldValue, $pref = null)
{
if (!\is_array($pref)) {
$pref = array();
$pref = [];
}
$pref += array(
$pref += [
'scheme' => 'B',
'input-charset' => self::$internalEncoding,
'output-charset' => self::$internalEncoding,
'line-length' => 76,
'line-break-chars' => "\r\n",
);
];
if (preg_match('/[\x80-\xFF]/', $fieldName)) {
$fieldName = '';
@@ -381,7 +380,7 @@ final class Iconv
preg_match_all('/./us', $fieldValue, $chars);
$chars = isset($chars[0]) ? $chars[0] : array();
$chars = $chars[0] ?? [];
$lineBreak = (int) $pref['line-length'];
$lineStart = "=?{$pref['output-charset']}?{$scheme}?";
@@ -389,7 +388,7 @@ final class Iconv
$lineOffset = \strlen($lineStart) + 3;
$lineData = '';
$fieldValue = array();
$fieldValue = [];
$Q = 'Q' === $scheme;
@@ -401,7 +400,7 @@ final class Iconv
$o = $Q
? $c = preg_replace_callback(
'/[=_\?\x00-\x1F\x80-\xFF]/',
array(__CLASS__, 'qpByteCallback'),
[__CLASS__, 'qpByteCallback'],
$c
)
: base64_encode($lineData.$c);
@@ -472,7 +471,7 @@ final class Iconv
while ($i < $len) {
$u = $s[$i] & "\xF0";
$i += isset($ulenMask[$u]) ? $ulenMask[$u] : 1;
$i += $ulenMask[$u] ?? 1;
++$j;
}
@@ -541,10 +540,14 @@ final class Iconv
$start += $slen;
}
if (0 > $start) {
return false;
if (\PHP_VERSION_ID < 80000) {
return false;
}
$start = 0;
}
if ($start >= $slen) {
return false;
return \PHP_VERSION_ID >= 80000 ? '' : false;
}
$rx = $slen - $start;
@@ -556,7 +559,7 @@ final class Iconv
return '';
}
if (0 > $length) {
return false;
return \PHP_VERSION_ID >= 80000 ? '' : false;
}
if ($length > $rx) {
@@ -607,7 +610,7 @@ final class Iconv
$u[$j++] = $str[$i++];
} else {
$ulen = $str[$i] & "\xF0";
$ulen = isset($ulenMask[$ulen]) ? $ulenMask[$ulen] : 1;
$ulen = $ulenMask[$ulen] ?? 1;
$uchr = substr($str, $i, $ulen);
if (1 === $ulen || !($valid || preg_match('/^.$/us', $uchr))) {
@@ -619,10 +622,10 @@ final class Iconv
trigger_error(self::ERROR_ILLEGAL_CHARACTER);
return false;
} else {
$i += $ulen;
}
$i += $ulen;
$u[$j++] = $uchr[0];
isset($uchr[1]) && 0 !== ($u[$j++] = $uchr[1])
@@ -669,15 +672,15 @@ final class Iconv
$uchr = $str[$i++];
} else {
$ulen = $str[$i] & "\xF0";
$ulen = isset($ulenMask[$ulen]) ? $ulenMask[$ulen] : 1;
$ulen = $ulenMask[$ulen] ?? 1;
$uchr = substr($str, $i, $ulen);
if ($ignore && (1 === $ulen || !($valid || preg_match('/^.$/us', $uchr)))) {
++$i;
continue;
} else {
$i += $ulen;
}
$i += $ulen;
}
if (isset($map[$uchr])) {
@@ -719,7 +722,7 @@ final class Iconv
private static function pregOffset($offset)
{
$rx = array();
$rx = [];
$offset = (int) $offset;
while ($offset > 65535) {

View File

@@ -2,8 +2,8 @@ Symfony Polyfill / Iconv
========================
This component provides a native PHP implementation of the
[php.net/iconv](http://php.net/iconv) functions
(short of [`ob_iconv_handler`](http://php.net/manual/en/function.ob-iconv-handler.php)).
[php.net/iconv](https://php.net/iconv) functions
(short of [`ob_iconv_handler`](https://php.net/ob-iconv-handler)).
More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md).

View File

@@ -1,6 +1,6 @@
<?php
static $data = array (
return array (
'µ' => 'μ',
'¼' => ' 14 ',
'½' => ' 12 ',
@@ -866,6 +866,7 @@ static $data = array (
'㋼' => '(ヰ)',
'㋽' => '(ヱ)',
'㋾' => '(ヲ)',
'㋿' => '令和',
'㌀' => 'アパート',
'㌁' => 'アルファ',
'㌂' => 'アンペア',
@@ -1392,13 +1393,13 @@ static $data = array (
'廓' => '廓',
'兀' => '兀',
'嗀' => '嗀',
'﨎' => '',
'﨏' => '',
'﨎' => '' . "\0" . '',
'﨏' => '' . "\0" . '',
'塚' => '塚',
'﨑' => '',
'﨑' => '' . "\0" . '',
'晴' => '晴',
'﨓' => '',
'﨔' => '',
'﨓' => '' . "\0" . '',
'﨔' => '' . "\0" . '',
'凞' => '凞',
'猪' => '猪',
'益' => '益',
@@ -1409,17 +1410,17 @@ static $data = array (
'靖' => '靖',
'精' => '精',
'羽' => '羽',
'﨟' => '',
'﨟' => '' . "\0" . '',
'蘒' => '蘒',
'﨡' => '',
'﨡' => '' . "\0" . '',
'諸' => '諸',
'﨣' => '',
'﨤' => '',
'﨣' => '' . "\0" . '',
'﨤' => '' . "\0" . '',
'逸' => '逸',
'都' => '都',
'﨧' => '',
'﨨' => '',
'﨩' => '',
'﨧' => '' . "\0" . '',
'﨨' => '' . "\0" . '',
'﨩' => '' . "\0" . '',
'飯' => '飯',
'飼' => '飼',
'館' => '館',
@@ -3133,6 +3134,7 @@ static $data = array (
'🈸' => '申',
'🈹' => '割',
'🈺' => '営',
'🈻' => '配',
'🉀' => '〔本〕',
'🉁' => '〔三〕',
'🉂' => '〔二〕',
@@ -3144,6 +3146,16 @@ static $data = array (
'🉈' => '〔敗〕',
'🉐' => '(得)',
'🉑' => '(可)',
'🯰' => '0',
'🯱' => '1',
'🯲' => '2',
'🯳' => '3',
'🯴' => '4',
'🯵' => '5',
'🯶' => '6',
'🯷' => '7',
'🯸' => '8',
'🯹' => '9',
'丽' => '丽',
'丸' => '丸',
'乁' => '乁',
@@ -3878,6 +3890,104 @@ static $data = array (
'ỽ' => 'v',
'Ỿ' => 'Y',
'ỿ' => 'y',
'Ⱡ' => 'L',
'ⱡ' => 'l',
'Ɫ' => 'L',
'Ᵽ' => 'P',
'Ɽ' => 'R',
'ⱥ' => 'a',
'ⱦ' => 't',
'Ⱨ' => 'H',
'ⱨ' => 'h',
'Ⱪ' => 'K',
'ⱪ' => 'k',
'Ⱬ' => 'Z',
'ⱬ' => 'z',
'Ɱ' => 'M',
'ⱱ' => 'v',
'Ⱳ' => 'W',
'ⱳ' => 'w',
'ⱴ' => 'v',
'ⱸ' => 'e',
'ⱺ' => 'o',
'Ȿ' => 'S',
'Ɀ' => 'Z',
'ꜰ' => 'F',
'' => 'S',
'Ꜳ' => 'AA',
'ꜳ' => 'aa',
'Ꜵ' => 'AO',
'ꜵ' => 'ao',
'Ꜷ' => 'AU',
'ꜷ' => 'au',
'Ꜹ' => 'AV',
'ꜹ' => 'av',
'Ꜻ' => 'AV',
'ꜻ' => 'av',
'Ꜽ' => 'AY',
'ꜽ' => 'ay',
'Ꝁ' => 'K',
'ꝁ' => 'k',
'Ꝃ' => 'K',
'ꝃ' => 'k',
'Ꝅ' => 'K',
'ꝅ' => 'k',
'Ꝇ' => 'L',
'ꝇ' => 'l',
'Ꝉ' => 'L',
'ꝉ' => 'l',
'Ꝋ' => 'O',
'ꝋ' => 'o',
'Ꝍ' => 'O',
'ꝍ' => 'o',
'Ꝏ' => 'OO',
'ꝏ' => 'oo',
'Ꝑ' => 'P',
'ꝑ' => 'p',
'Ꝓ' => 'P',
'ꝓ' => 'p',
'Ꝕ' => 'P',
'ꝕ' => 'p',
'Ꝗ' => 'Q',
'ꝗ' => 'q',
'Ꝙ' => 'Q',
'ꝙ' => 'q',
'Ꝟ' => 'V',
'ꝟ' => 'v',
'Ꝡ' => 'VY',
'ꝡ' => 'vy',
'Ꝥ' => 'TH',
'ꝥ' => 'th',
'Ꝧ' => 'TH',
'ꝧ' => 'th',
'ꝱ' => 'd',
'ꝲ' => 'l',
'ꝳ' => 'm',
'ꝴ' => 'n',
'ꝵ' => 'r',
'ꝶ' => 'R',
'ꝷ' => 't',
'Ꝺ' => 'D',
'ꝺ' => 'd',
'Ꝼ' => 'F',
'ꝼ' => 'f',
'Ꞇ' => 'T',
'ꞇ' => 't',
'Ꞑ' => 'N',
'ꞑ' => 'n',
'Ꞓ' => 'C',
'ꞓ' => 'c',
'Ꞡ' => 'G',
'ꞡ' => 'g',
'Ꞣ' => 'K',
'ꞣ' => 'k',
'Ꞥ' => 'N',
'ꞥ' => 'n',
'Ꞧ' => 'R',
'ꞧ' => 'r',
'Ꞩ' => 'S',
'ꞩ' => 's',
'Ɦ' => 'H',
'©' => '(C)',
'®' => '(R)',
'₠' => 'CE',
@@ -3885,10 +3995,30 @@ static $data = array (
'₣' => 'Fr.',
'₤' => 'L.',
'₧' => 'Pts',
'₺' => 'TL',
'₹' => 'Rs',
'₺' => 'TL',
'℗' => '(P)',
'℘' => 'P',
'℞' => 'Rx',
'' => '0',
' ' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'' => ' ',
'ʹ' => '\'',
'ʺ' => '"',
'ʻ' => '\'',
'ʼ' => '\'',
'ʽ' => '\'',
'ˈ' => '\'',
'ˋ' => '`',
'' => '\'',
'' => '\'',
'' => ',',
@@ -3904,6 +4034,7 @@ static $data = array (
'»' => '>>',
'' => '<',
'' => '>',
'­' => '-',
'' => '-',
'' => '-',
'' => '-',
@@ -3912,6 +4043,14 @@ static $data = array (
'―' => '-',
'︱' => '-',
'︲' => '-',
'¡' => '!',
'¿' => '?',
'˂' => '<',
'˃' => '>',
'˄' => '^',
'ˆ' => '^',
'ː' => ':',
'˜' => '~',
'‖' => '||',
'' => '/',
'⁅' => '[',
@@ -3950,8 +4089,11 @@ static $data = array (
'﹀' => '>',
'﹇' => '[',
'﹈' => ']',
'±' => '+/-',
'×' => '*',
'÷' => '/',
'˖' => '+',
'˗' => '-',
'' => '-',
'' => '/',
'' => '\\',
@@ -3962,8 +4104,3 @@ static $data = array (
'⦅' => '((',
'⦆' => '))',
);
$result =& $data;
unset($data);
return $result;

View File

@@ -11,34 +11,78 @@
use Symfony\Polyfill\Iconv as p;
if (!function_exists('iconv')) {
if (extension_loaded('iconv')) {
return;
}
if (\PHP_VERSION_ID >= 80000) {
return require __DIR__.'/bootstrap80.php';
}
if (!defined('ICONV_IMPL')) {
define('ICONV_IMPL', 'Symfony');
}
if (!defined('ICONV_VERSION')) {
define('ICONV_VERSION', '1.0');
}
if (!defined('ICONV_MIME_DECODE_STRICT')) {
define('ICONV_MIME_DECODE_STRICT', 1);
}
if (!defined('ICONV_MIME_DECODE_CONTINUE_ON_ERROR')) {
define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
}
function iconv($from, $to, $s) { return p\Iconv::iconv($from, $to, $s); }
if (!function_exists('iconv')) {
function iconv($from_encoding, $to_encoding, $string) { return p\Iconv::iconv($from_encoding, $to_encoding, $string); }
}
if (!function_exists('iconv_get_encoding')) {
function iconv_get_encoding($type = 'all') { return p\Iconv::iconv_get_encoding($type); }
function iconv_set_encoding($type, $charset) { return p\Iconv::iconv_set_encoding($type, $charset); }
function iconv_mime_encode($name, $value, $pref = null) { return p\Iconv::iconv_mime_encode($name, $value, $pref); }
function iconv_mime_decode_headers($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode_headers($encodedHeaders, $mode, $enc); }
}
if (!function_exists('iconv_set_encoding')) {
function iconv_set_encoding($type, $encoding) { return p\Iconv::iconv_set_encoding($type, $encoding); }
}
if (!function_exists('iconv_mime_encode')) {
function iconv_mime_encode($field_name, $field_value, $options = []) { return p\Iconv::iconv_mime_encode($field_name, $field_value, $options); }
}
if (!function_exists('iconv_mime_decode_headers')) {
function iconv_mime_decode_headers($headers, $mode = 0, $encoding = null) { return p\Iconv::iconv_mime_decode_headers($headers, $mode, $encoding); }
}
if (extension_loaded('mbstring')) {
function iconv_strlen($s, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strlen($s, $enc); }
function iconv_strpos($s, $needle, $offset = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strpos($s, $needle, $offset, $enc); }
function iconv_strrpos($s, $needle, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_strrpos($s, $needle, 0, $enc); }
function iconv_substr($s, $start, $length = 2147483647, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_substr($s, $start, $length, $enc); }
function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { null === $enc and $enc = p\Iconv::$internalEncoding; return mb_decode_mimeheader($encodedHeaders, $mode, $enc); }
} else {
if (extension_loaded('mbstring')) {
if (!function_exists('iconv_strlen')) {
function iconv_strlen($string, $encoding = null) { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_strlen($string, $encoding); }
}
if (!function_exists('iconv_strpos')) {
function iconv_strpos($haystack, $needle, $offset = 0, $encoding = null) { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_strpos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('iconv_strrpos')) {
function iconv_strrpos($haystack, $needle, $encoding = null) { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_strrpos($haystack, $needle, 0, $encoding); }
}
if (!function_exists('iconv_substr')) {
function iconv_substr($string, $offset, $length = 2147483647, $encoding = null) { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_substr($string, $offset, $length, $encoding); }
}
if (!function_exists('iconv_mime_decode')) {
function iconv_mime_decode($string, $mode = 0, $encoding = null) { $currentMbEncoding = mb_internal_encoding(); null === $encoding && $encoding = p\Iconv::$internalEncoding; mb_internal_encoding($encoding); $decoded = mb_decode_mimeheader($string); mb_internal_encoding($currentMbEncoding); return $decoded; }
}
} else {
if (!function_exists('iconv_strlen')) {
if (extension_loaded('xml')) {
function iconv_strlen($s, $enc = null) { return p\Iconv::strlen1($s, $enc); }
function iconv_strlen($string, $encoding = null) { return p\Iconv::strlen1($string, $encoding); }
} else {
function iconv_strlen($s, $enc = null) { return p\Iconv::strlen2($s, $enc); }
function iconv_strlen($string, $encoding = null) { return p\Iconv::strlen2($string, $encoding); }
}
}
function iconv_strpos($s, $needle, $offset = 0, $enc = null) { return p\Iconv::iconv_strpos($s, $needle, $offset, $enc); }
function iconv_strrpos($s, $needle, $enc = null) { return p\Iconv::iconv_strrpos($s, $needle, $enc); }
function iconv_substr($s, $start, $length = 2147483647, $enc = null) { return p\Iconv::iconv_substr($s, $start, $length, $enc); }
function iconv_mime_decode($encodedHeaders, $mode = 0, $enc = null) { return p\Iconv::iconv_mime_decode($encodedHeaders, $mode, $enc); }
if (!function_exists('iconv_strpos')) {
function iconv_strpos($haystack, $needle, $offset = 0, $encoding = null) { return p\Iconv::iconv_strpos($haystack, $needle, $offset, $encoding); }
}
if (!function_exists('iconv_strrpos')) {
function iconv_strrpos($haystack, $needle, $encoding = null) { return p\Iconv::iconv_strrpos($haystack, $needle, $encoding); }
}
if (!function_exists('iconv_substr')) {
function iconv_substr($string, $offset, $length = 2147483647, $encoding = null) { return p\Iconv::iconv_substr($string, $offset, $length, $encoding); }
}
if (!function_exists('iconv_mime_decode')) {
function iconv_mime_decode($string, $mode = 0, $encoding = null) { return p\Iconv::iconv_mime_decode($string, $mode, $encoding); }
}
}

View File

@@ -0,0 +1,80 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Iconv as p;
if (!defined('ICONV_IMPL')) {
define('ICONV_IMPL', 'Symfony');
}
if (!defined('ICONV_VERSION')) {
define('ICONV_VERSION', '1.0');
}
if (!defined('ICONV_MIME_DECODE_STRICT')) {
define('ICONV_MIME_DECODE_STRICT', 1);
}
if (!defined('ICONV_MIME_DECODE_CONTINUE_ON_ERROR')) {
define('ICONV_MIME_DECODE_CONTINUE_ON_ERROR', 2);
}
if (!function_exists('iconv')) {
function iconv(?string $from_encoding, ?string $to_encoding, ?string $string): string|false { return p\Iconv::iconv((string) $from_encoding, (string) $to_encoding, (string) $string); }
}
if (!function_exists('iconv_get_encoding')) {
function iconv_get_encoding(?string $type = 'all'): array|string|false { return p\Iconv::iconv_get_encoding((string) $type); }
}
if (!function_exists('iconv_set_encoding')) {
function iconv_set_encoding(?string $type, ?string $encoding): bool { return p\Iconv::iconv_set_encoding((string) $type, (string) $encoding); }
}
if (!function_exists('iconv_mime_encode')) {
function iconv_mime_encode(?string $field_name, ?string $field_value, ?array $options = []): string|false { return p\Iconv::iconv_mime_encode((string) $field_name, (string) $field_value, (array) $options); }
}
if (!function_exists('iconv_mime_decode_headers')) {
function iconv_mime_decode_headers(?string $headers, ?int $mode = 0, ?string $encoding = null): array|false { return p\Iconv::iconv_mime_decode_headers((string) $headers, (int) $mode, $encoding); }
}
if (extension_loaded('mbstring')) {
if (!function_exists('iconv_strlen')) {
function iconv_strlen(?string $string, ?string $encoding = null): int|false { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_strlen((string) $string, $encoding); }
}
if (!function_exists('iconv_strpos')) {
function iconv_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
}
if (!function_exists('iconv_strrpos')) {
function iconv_strrpos(?string $haystack, ?string $needle, ?string $encoding = null): int|false { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_strrpos((string) $haystack, (string) $needle, 0, $encoding); }
}
if (!function_exists('iconv_substr')) {
function iconv_substr(?string $string, ?int $offset, ?int $length = null, ?string $encoding = null): string|false { null === $encoding && $encoding = p\Iconv::$internalEncoding; return mb_substr((string) $string, (int) $offset, $length, $encoding); }
}
if (!function_exists('iconv_mime_decode')) {
function iconv_mime_decode($string, $mode = 0, $encoding = null) { $currentMbEncoding = mb_internal_encoding(); null === $encoding && $encoding = p\Iconv::$internalEncoding; mb_internal_encoding($encoding); $decoded = mb_decode_mimeheader($string); mb_internal_encoding($currentMbEncoding); return $decoded; }
}
} else {
if (!function_exists('iconv_strlen')) {
if (extension_loaded('xml')) {
function iconv_strlen(?string $string, ?string $encoding = null): int|false { return p\Iconv::strlen1((string) $string, $encoding); }
} else {
function iconv_strlen(?string $string, ?string $encoding = null): int|false { return p\Iconv::strlen2((string) $string, $encoding); }
}
}
if (!function_exists('iconv_strpos')) {
function iconv_strpos(?string $haystack, ?string $needle, ?int $offset = 0, ?string $encoding = null): int|false { return p\Iconv::iconv_strpos((string) $haystack, (string) $needle, (int) $offset, $encoding); }
}
if (!function_exists('iconv_strrpos')) {
function iconv_strrpos(?string $haystack, ?string $needle, ?string $encoding = null): int|false { return p\Iconv::iconv_strrpos((string) $haystack, (string) $needle, $encoding); }
}
if (!function_exists('iconv_substr')) {
function iconv_substr(?string $string, ?int $offset, ?int $length = null, ?string $encoding = null): string|false { return p\Iconv::iconv_substr((string) $string, (string) $offset, $length, $encoding); }
}
if (!function_exists('iconv_mime_decode')) {
function iconv_mime_decode(?string $string, ?int $mode = 0, ?string $encoding = null): string|false { return p\Iconv::iconv_mime_decode((string) $string, (int) $mode, $encoding); }
}
}

View File

@@ -16,7 +16,10 @@
}
],
"require": {
"php": ">=5.3.3"
"php": ">=7.1"
},
"provide": {
"ext-iconv": "*"
},
"autoload": {
"psr-4": { "Symfony\\Polyfill\\Iconv\\": "" },
@@ -28,7 +31,11 @@
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
}
}