Updated Symfony\polyfill-mbstring
to version 1.27.0
This commit is contained in:
parent
16aad8eb38
commit
5f7440166e
3 changed files with 33 additions and 32 deletions
|
@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Changed
|
||||
- Updated `Symfony\Filesystem` to version 6.2.5
|
||||
- Updated `Symfony\polyfill-ctype` to version 1.27.0
|
||||
|
||||
- Updated `Symfony\polyfill-mbstring` to version 1.27.0
|
||||
|
||||
## [1.0.1] - 2023-02-07
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ final class Mbstring
|
|||
|
||||
public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
|
||||
{
|
||||
if (\is_array($fromEncoding) || ($fromEncoding !== null && false !== strpos($fromEncoding, ','))) {
|
||||
if (\is_array($fromEncoding) || (null !== $fromEncoding && false !== strpos($fromEncoding, ','))) {
|
||||
$fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
|
||||
} else {
|
||||
$fromEncoding = self::getEncoding($fromEncoding);
|
||||
|
@ -102,7 +102,7 @@ final class Mbstring
|
|||
$fromEncoding = 'Windows-1252';
|
||||
}
|
||||
if ('UTF-8' !== $fromEncoding) {
|
||||
$s = \iconv($fromEncoding, 'UTF-8//IGNORE', $s);
|
||||
$s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
|
||||
return preg_replace_callback('/[\x80-\xFF]+/', [__CLASS__, 'html_encoding_callback'], $s);
|
||||
|
@ -113,7 +113,7 @@ final class Mbstring
|
|||
$fromEncoding = 'UTF-8';
|
||||
}
|
||||
|
||||
return \iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
|
||||
return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
|
||||
}
|
||||
|
||||
public static function mb_convert_variables($toEncoding, $fromEncoding, &...$vars)
|
||||
|
@ -130,7 +130,7 @@ final class Mbstring
|
|||
|
||||
public static function mb_decode_mimeheader($s)
|
||||
{
|
||||
return \iconv_mime_decode($s, 2, self::$internalEncoding);
|
||||
return iconv_mime_decode($s, 2, self::$internalEncoding);
|
||||
}
|
||||
|
||||
public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
|
||||
|
@ -140,7 +140,7 @@ final class Mbstring
|
|||
|
||||
public static function mb_decode_numericentity($s, $convmap, $encoding = null)
|
||||
{
|
||||
if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
|
||||
if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
|
||||
trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
|
@ -150,7 +150,7 @@ final class Mbstring
|
|||
return false;
|
||||
}
|
||||
|
||||
if (null !== $encoding && !is_scalar($encoding)) {
|
||||
if (null !== $encoding && !\is_scalar($encoding)) {
|
||||
trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
|
||||
|
||||
return ''; // Instead of null (cf. mb_encode_numericentity).
|
||||
|
@ -166,10 +166,10 @@ final class Mbstring
|
|||
if ('UTF-8' === $encoding) {
|
||||
$encoding = null;
|
||||
if (!preg_match('//u', $s)) {
|
||||
$s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
|
||||
$s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
} else {
|
||||
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
|
||||
$cnt = floor(\count($convmap) / 4) * 4;
|
||||
|
@ -195,12 +195,12 @@ final class Mbstring
|
|||
return $s;
|
||||
}
|
||||
|
||||
return \iconv('UTF-8', $encoding.'//IGNORE', $s);
|
||||
return iconv('UTF-8', $encoding.'//IGNORE', $s);
|
||||
}
|
||||
|
||||
public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
|
||||
{
|
||||
if (null !== $s && !is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
|
||||
if (null !== $s && !\is_scalar($s) && !(\is_object($s) && method_exists($s, '__toString'))) {
|
||||
trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', \E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
|
@ -210,13 +210,13 @@ final class Mbstring
|
|||
return false;
|
||||
}
|
||||
|
||||
if (null !== $encoding && !is_scalar($encoding)) {
|
||||
if (null !== $encoding && !\is_scalar($encoding)) {
|
||||
trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', \E_USER_WARNING);
|
||||
|
||||
return null; // Instead of '' (cf. mb_decode_numericentity).
|
||||
}
|
||||
|
||||
if (null !== $is_hex && !is_scalar($is_hex)) {
|
||||
if (null !== $is_hex && !\is_scalar($is_hex)) {
|
||||
trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', \E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
|
@ -232,10 +232,10 @@ final class Mbstring
|
|||
if ('UTF-8' === $encoding) {
|
||||
$encoding = null;
|
||||
if (!preg_match('//u', $s)) {
|
||||
$s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
|
||||
$s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
} else {
|
||||
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
|
||||
static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
|
||||
|
@ -265,7 +265,7 @@ final class Mbstring
|
|||
return $result;
|
||||
}
|
||||
|
||||
return \iconv('UTF-8', $encoding.'//IGNORE', $result);
|
||||
return iconv('UTF-8', $encoding.'//IGNORE', $result);
|
||||
}
|
||||
|
||||
public static function mb_convert_case($s, $mode, $encoding = null)
|
||||
|
@ -280,10 +280,10 @@ final class Mbstring
|
|||
if ('UTF-8' === $encoding) {
|
||||
$encoding = null;
|
||||
if (!preg_match('//u', $s)) {
|
||||
$s = @\iconv('UTF-8', 'UTF-8//IGNORE', $s);
|
||||
$s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
} else {
|
||||
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
|
||||
if (\MB_CASE_TITLE == $mode) {
|
||||
|
@ -343,7 +343,7 @@ final class Mbstring
|
|||
return $s;
|
||||
}
|
||||
|
||||
return \iconv('UTF-8', $encoding.'//IGNORE', $s);
|
||||
return iconv('UTF-8', $encoding.'//IGNORE', $s);
|
||||
}
|
||||
|
||||
public static function mb_internal_encoding($encoding = null)
|
||||
|
@ -354,7 +354,7 @@ final class Mbstring
|
|||
|
||||
$normalizedEncoding = self::getEncoding($encoding);
|
||||
|
||||
if ('UTF-8' === $normalizedEncoding || false !== @\iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
|
||||
if ('UTF-8' === $normalizedEncoding || false !== @iconv($normalizedEncoding, $normalizedEncoding, ' ')) {
|
||||
self::$internalEncoding = $normalizedEncoding;
|
||||
|
||||
return true;
|
||||
|
@ -413,7 +413,7 @@ final class Mbstring
|
|||
$encoding = self::$internalEncoding;
|
||||
}
|
||||
|
||||
return self::mb_detect_encoding($var, [$encoding]) || false !== @\iconv($encoding, $encoding, $var);
|
||||
return self::mb_detect_encoding($var, [$encoding]) || false !== @iconv($encoding, $encoding, $var);
|
||||
}
|
||||
|
||||
public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
|
||||
|
@ -488,7 +488,7 @@ final class Mbstring
|
|||
return \strlen($s);
|
||||
}
|
||||
|
||||
return @\iconv_strlen($s, $encoding);
|
||||
return @iconv_strlen($s, $encoding);
|
||||
}
|
||||
|
||||
public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
|
||||
|
@ -509,7 +509,7 @@ final class Mbstring
|
|||
return 0;
|
||||
}
|
||||
|
||||
return \iconv_strpos($haystack, $needle, $offset, $encoding);
|
||||
return iconv_strpos($haystack, $needle, $offset, $encoding);
|
||||
}
|
||||
|
||||
public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
|
||||
|
@ -533,7 +533,7 @@ final class Mbstring
|
|||
}
|
||||
|
||||
$pos = '' !== $needle || 80000 > \PHP_VERSION_ID
|
||||
? \iconv_strrpos($haystack, $needle, $encoding)
|
||||
? iconv_strrpos($haystack, $needle, $encoding)
|
||||
: self::mb_strlen($haystack, $encoding);
|
||||
|
||||
return false !== $pos ? $offset + $pos : false;
|
||||
|
@ -541,7 +541,7 @@ final class Mbstring
|
|||
|
||||
public static function mb_str_split($string, $split_length = 1, $encoding = null)
|
||||
{
|
||||
if (null !== $string && !is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
|
||||
if (null !== $string && !\is_scalar($string) && !(\is_object($string) && method_exists($string, '__toString'))) {
|
||||
trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', \E_USER_WARNING);
|
||||
|
||||
return null;
|
||||
|
@ -550,6 +550,7 @@ final class Mbstring
|
|||
if (1 > $split_length = (int) $split_length) {
|
||||
if (80000 > \PHP_VERSION_ID) {
|
||||
trigger_error('The length of each segment must be greater than zero', \E_USER_WARNING);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -617,7 +618,7 @@ final class Mbstring
|
|||
}
|
||||
|
||||
if ($start < 0) {
|
||||
$start = \iconv_strlen($s, $encoding) + $start;
|
||||
$start = iconv_strlen($s, $encoding) + $start;
|
||||
if ($start < 0) {
|
||||
$start = 0;
|
||||
}
|
||||
|
@ -626,13 +627,13 @@ final class Mbstring
|
|||
if (null === $length) {
|
||||
$length = 2147483647;
|
||||
} elseif ($length < 0) {
|
||||
$length = \iconv_strlen($s, $encoding) + $length - $start;
|
||||
$length = iconv_strlen($s, $encoding) + $length - $start;
|
||||
if ($length < 0) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
return (string) \iconv_substr($s, $start, $length, $encoding);
|
||||
return (string) iconv_substr($s, $start, $length, $encoding);
|
||||
}
|
||||
|
||||
public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
|
||||
|
@ -657,7 +658,7 @@ final class Mbstring
|
|||
$pos = strrpos($haystack, $needle);
|
||||
} else {
|
||||
$needle = self::mb_substr($needle, 0, 1, $encoding);
|
||||
$pos = \iconv_strrpos($haystack, $needle, $encoding);
|
||||
$pos = iconv_strrpos($haystack, $needle, $encoding);
|
||||
}
|
||||
|
||||
return self::getSubpart($pos, $part, $haystack, $encoding);
|
||||
|
@ -736,12 +737,12 @@ final class Mbstring
|
|||
$encoding = self::getEncoding($encoding);
|
||||
|
||||
if ('UTF-8' !== $encoding) {
|
||||
$s = \iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
$s = iconv($encoding, 'UTF-8//IGNORE', $s);
|
||||
}
|
||||
|
||||
$s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
|
||||
|
||||
return ($wide << 1) + \iconv_strlen($s, 'UTF-8');
|
||||
return ($wide << 1) + iconv_strlen($s, 'UTF-8');
|
||||
}
|
||||
|
||||
public static function mb_substr_count($haystack, $needle, $encoding = null)
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.26.0
|
||||
1.27.0
|
Loading…
Add table
Reference in a new issue