: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
return false === $pos ? false : ($offset + ($pos ? self::iconv_strlen(substr($haystack, 0, $pos), 'utf-8') : 0));
public static function iconv_strrpos($haystack, $needle, $encoding = null)
if (null === $encoding) {
$encoding = self::$internalEncoding;
if (0 !== stripos($encoding, 'utf-8')) {
if (false === $haystack = self::iconv($encoding, 'utf-8', $haystack)) {
if (false === $needle = self::iconv($encoding, 'utf-8', $needle)) {
$pos = isset($needle[0]) ? strrpos($haystack, $needle) : false;
return false === $pos ? false : self::iconv_strlen($pos ? substr($haystack, 0, $pos) : $haystack, 'utf-8');
public static function iconv_substr($s, $start, $length = 2147483647, $encoding = null)
if (null === $encoding) {
$encoding = self::$internalEncoding;
if (0 !== stripos($encoding, 'utf-8')) {
} elseif (false === $s = self::iconv($encoding, 'utf-8', $s)) {
$slen = self::iconv_strlen($s, 'utf-8');
if (\PHP_VERSION_ID < 80000) {
return \PHP_VERSION_ID >= 80000 ? '' : false;
return \PHP_VERSION_ID >= 80000 ? '' : false;
$rx = '/^'.($start ? self::pregOffset($start) : '').'('.self::pregOffset($length).')/u';
$s = preg_match($rx, $s, $s) ? $s[1] : '';
if (null === $encoding) {
return self::iconv('utf-8', $encoding, $s);
private static function loadMap($type, $charset, &$map)
if (!isset(self::$convertMap[$type.$charset])) {
if (false === $map = self::getData($type.$charset)) {
if ('to.' === $type && self::loadMap('from.', $charset, $map)) {
self::$convertMap[$type.$charset] = $map;
$map = self::$convertMap[$type.$charset];
private static function utf8ToUtf8($str, $ignore)
$ulenMask = self::$ulenMask;
$valid = self::$isValidUtf8;
$ulen = $str[$i] & "\xF0";
$ulen = isset($ulenMask[$ulen]) ? $ulenMask[$ulen] : 1;
$uchr = substr($str, $i, $ulen);
if (1 === $ulen || !($valid || preg_match('/^.$/us', $uchr))) {
trigger_error(self::ERROR_ILLEGAL_CHARACTER);
isset($uchr[1]) && 0 !== ($u[$j++] = $uchr[1])
&& isset($uchr[2]) && 0 !== ($u[$j++] = $uchr[2])
&& isset($uchr[3]) && 0 !== ($u[$j++] = $uchr[3]);
return substr($u, 0, $j);
private static function mapToUtf8(&$result, array $map, $str, $ignore)
for ($i = 0; $i < $len; ++$i) {
if (isset($str[$i + 1], $map[$str[$i].$str[$i + 1]])) {
$result .= $map[$str[$i].$str[++$i]];
} elseif (isset($map[$str[$i]])) {
$result .= $map[$str[$i]];
trigger_error(self::ERROR_ILLEGAL_CHARACTER);
private static function mapFromUtf8(&$result, array $map, $str, $ignore, $translit)
$ulenMask = self::$ulenMask;
$valid = self::$isValidUtf8;
if ($translit && !self::$translitMap) {
self::$translitMap = self::getData('translit');
$ulen = $str[$i] & "\xF0";
$ulen = isset($ulenMask[$ulen]) ? $ulenMask[$ulen] : 1;
$uchr = substr($str, $i, $ulen);
if ($ignore && (1 === $ulen || !($valid || preg_match('/^.$/us', $uchr)))) {
if (isset($map[$uchr])) {
if (isset(self::$translitMap[$uchr])) {
$uchr = self::$translitMap[$uchr];
} elseif ($uchr >= "\xC3\x80") {
$uchr = \Normalizer::normalize($uchr, \Normalizer::NFD);
$str = $uchr.substr($str, $i);
private static function qpByteCallback(array $m)
return '='.strtoupper(dechex(\ord($m[0])));
private static function pregOffset($offset)
while ($offset > 65535) {
return implode('', $rx).'.{'.$offset.'}';
private static function getData($file)
if (file_exists($file = __DIR__.'/Resources/charset/'.$file.'.php')) {