X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fpolyfill-iconv%2FIconv.php;fp=vendor%2Fsymfony%2Fpolyfill-iconv%2FIconv.php;h=74992f6b803817683b680c364317484b35ba2aa6;hp=8a1e074da0fc7042707e33c1f273d455f33bffe8;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/polyfill-iconv/Iconv.php b/vendor/symfony/polyfill-iconv/Iconv.php index 8a1e074da..74992f6b8 100644 --- a/vendor/symfony/polyfill-iconv/Iconv.php +++ b/vendor/symfony/polyfill-iconv/Iconv.php @@ -127,7 +127,8 @@ final class Iconv public static function iconv($inCharset, $outCharset, $str) { - if ('' === $str .= '') { + $str = (string) $str; + if ('' === $str) { return ''; } @@ -145,22 +146,33 @@ final class Iconv $inCharset = 'iso-8859-1'; } - if ('//translit' === substr($outCharset, -10)) { - $translit = '//TRANSLIT'; - $outCharset = substr($outCharset, 0, -10); - } + do { + $loop = false; - if ('//ignore' === substr($outCharset, -8)) { - $ignore = '//IGNORE'; - $outCharset = substr($outCharset, 0, -8); - } + if ('//translit' === substr($outCharset, -10)) { + $loop = $translit = true; + $outCharset = substr($outCharset, 0, -10); + } - if ('//translit' === substr($inCharset, -10)) { - $inCharset = substr($inCharset, 0, -10); - } - if ('//ignore' === substr($inCharset, -8)) { - $inCharset = substr($inCharset, 0, -8); - } + if ('//ignore' === substr($outCharset, -8)) { + $loop = $ignore = true; + $outCharset = substr($outCharset, 0, -8); + } + } while ($loop); + + do { + $loop = false; + + if ('//translit' === substr($inCharset, -10)) { + $loop = true; + $inCharset = substr($inCharset, 0, -10); + } + + if ('//ignore' === substr($inCharset, -8)) { + $loop = true; + $inCharset = substr($inCharset, 0, -8); + } + } while ($loop); if (isset(self::$alias[ $inCharset])) { $inCharset = self::$alias[ $inCharset]; @@ -521,7 +533,7 @@ final class Iconv return false; } - $s .= ''; + $s = (string) $s; $slen = self::iconv_strlen($s, 'utf-8'); $start = (int) $start; @@ -622,7 +634,7 @@ final class Iconv return substr($u, 0, $j); } - private static function mapToUtf8(&$result, $map, $str, $ignore) + private static function mapToUtf8(&$result, array $map, $str, $ignore) { $len = strlen($str); for ($i = 0; $i < $len; ++$i) { @@ -640,7 +652,7 @@ final class Iconv return true; } - private static function mapFromUtf8(&$result, $map, $str, $ignore, $translit) + private static function mapFromUtf8(&$result, array $map, $str, $ignore, $translit) { $ulenMask = self::$ulenMask; $valid = self::$isValidUtf8; @@ -696,7 +708,7 @@ final class Iconv return true; } - private static function qpByteCallback($m) + private static function qpByteCallback(array $m) { return '='.strtoupper(dechex(ord($m[0]))); }