MB_FIX_PHP: "\nuse Symfony\\Polyfill\\Mbstring\\Mbstring;\n\nfunction cfw_mb_installed(): bool\n{\n\treturn true;\n}\n\nfunction mb_substr($string, $start, $length = null, $encoding = null)\n{\n\tif (cfw_mb_ascii($string)) {\n\t\treturn substr($string, $start, $length);\n\t}\n\treturn Mbstring::mb_substr(cfw_mb_sanitize($string), $start, $length, $encoding);\n}\nfunction mb_strlen($string, $encoding = null)\n{\n\tif (cfw_mb_ascii($string)) {\n\t\treturn strlen($string);\n\t}\n\treturn Mbstring::mb_strlen(cfw_mb_sanitize($string), $encoding);\n}\nfunction mb_strtolower($string, $encoding = null)\n{\n\tif (cfw_mb_ascii($string)) {\n\t\treturn strtolower($string);\n\t}\n\t$s = cfw_mb_sanitize($string);\n\tif (cfw_mb_utf8($encoding)) {\n\t\t$s = cfw_mb_patch($s, 'lower');\n\t}\n\treturn cfw_mb_final_sigma(Mbstring::mb_strtolower($s, $encoding));\n}\nfunction mb_strtoupper($string, $encoding = null)\n{\n\tif (cfw_mb_ascii($string)) {\n\t\treturn strtoupper($string);\n\t}\n\t$s = cfw_mb_sanitize($string);\n\tif (cfw_mb_utf8($encoding)) {\n\t\t$s = cfw_mb_patch($s, 'upper');\n\t}\n\treturn Mbstring::mb_strtoupper($s, $encoding);\n}\nfunction mb_convert_case($string, $mode, $encoding = null)\n{\n\t// 0 UPPER, 1 LOWER, 2 TITLE, 3 FOLD, spelled as ints because the constants are defined by\n\t// the polyfill bootstrap that this fragment runs before\n\t$s = cfw_mb_sanitize($string);\n\t$mode = (int) $mode;\n\t$utf8 = cfw_mb_utf8($encoding);\n\t$re = $mode === 2 && $utf8 ? cfw_mb_title_regexp() : null;\n\tif ($re !== null) {\n\t\t// a substituted byte does NOT break a word natively -- mbstring carries an error marker\n\t\t// through the casing pass and only renders \"?\" on output -- so the word split runs over a\n\t\t// case-IGNORABLE stand-in. U+E0001 is on the polyfill's own lookbehind list, and the path\n\t\t// is taken only for input that is already invalid and provably does not contain it\n\t\t$tag = \"\\xf3\\xa0\\x80\\x81\";\n\t\t$tagged = $s !== $string && strpos((string) $string, $tag) === false;\n\t\t$out = preg_replace_callback(\n\t\t\t$re,\n\t\t\t'cfw_mb_title_word',\n\t\t\t$tagged ? cfw_mb_sanitize($string, $tag) : $s,\n\t\t);\n\t\tif ($tagged) {\n\t\t\t$out = str_replace($tag, '?', $out);\n\t\t}\n\t} else {\n\t\t// FOLD is left unpatched: the table is a case delta and folding is a third operation\n\t\tif ($utf8 && ($mode === 0 || $mode === 1)) {\n\t\t\t$s = cfw_mb_patch($s, $mode === 0 ? 'upper' : 'lower');\n\t\t}\n\t\t$out = Mbstring::mb_convert_case($s, $mode, $encoding);\n\t}\n\t// UPPER has no final-sigma rule; LOWER and TITLE both do\n\treturn $mode === 0 ? $out : cfw_mb_final_sigma($out);\n}\nfunction mb_strpos($haystack, $needle, $offset = 0, $encoding = null)\n{\n\treturn Mbstring::mb_strpos(\n\t\tcfw_mb_sanitize($haystack),\n\t\tcfw_mb_sanitize($needle),\n\t\t$offset,\n\t\t$encoding,\n\t);\n}\nfunction mb_stripos($haystack, $needle, $offset = 0, $encoding = null)\n{\n\treturn Mbstring::mb_stripos(\n\t\tcfw_mb_fold_safe(cfw_mb_sanitize($haystack)),\n\t\tcfw_mb_fold_safe(cfw_mb_sanitize($needle)),\n\t\t$offset,\n\t\t$encoding,\n\t);\n}\nfunction mb_strripos($haystack, $needle, $offset = 0, $encoding = null)\n{\n\treturn Mbstring::mb_strripos(\n\t\tcfw_mb_fold_safe(cfw_mb_sanitize($haystack)),\n\t\tcfw_mb_fold_safe(cfw_mb_sanitize($needle)),\n\t\t$offset,\n\t\t$encoding,\n\t);\n}\nfunction mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)\n{\n\treturn Mbstring::mb_strrpos(\n\t\tcfw_mb_sanitize($haystack),\n\t\tcfw_mb_sanitize($needle),\n\t\t$offset,\n\t\t$encoding,\n\t);\n}\nfunction mb_str_split($string, $length = 1, $encoding = null)\n{\n\treturn Mbstring::mb_str_split(cfw_mb_sanitize($string), $length, $encoding);\n}\nfunction mb_substr_count($haystack, $needle, $encoding = null)\n{\n\treturn Mbstring::mb_substr_count(\n\t\tcfw_mb_sanitize($haystack),\n\t\tcfw_mb_sanitize($needle),\n\t\t$encoding,\n\t);\n}\nfunction mb_strstr($haystack, $needle, $before_needle = false, $encoding = null)\n{\n\treturn Mbstring::mb_strstr(\n\t\tcfw_mb_sanitize($haystack),\n\t\tcfw_mb_sanitize($needle),\n\t\t$before_needle,\n\t\t$encoding,\n\t);\n}\nfunction mb_stristr($haystack, $needle, $before_needle = false, $encoding = null)\n{\n\t$h = cfw_mb_sanitize($haystack);\n\t$pos = Mbstring::mb_stripos(\n\t\tcfw_mb_fold_safe($h),\n\t\tcfw_mb_fold_safe(cfw_mb_sanitize($needle)),\n\t\t0,\n\t\t$encoding,\n\t);\n\treturn cfw_mb_isubpart($h, $pos, $before_needle, $encoding);\n}\nfunction mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null)\n{\n\treturn Mbstring::mb_strrchr(\n\t\tcfw_mb_sanitize($haystack),\n\t\tcfw_mb_sanitize($needle),\n\t\t$before_needle,\n\t\t$encoding,\n\t);\n}\nfunction mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null)\n{\n\t$h = cfw_mb_sanitize($haystack);\n\t$n = Mbstring::mb_substr(cfw_mb_sanitize($needle), 0, 1, $encoding);\n\t$pos = Mbstring::mb_strripos(cfw_mb_fold_safe($h), cfw_mb_fold_safe($n), 0, $encoding);\n\treturn cfw_mb_isubpart($h, $pos, $before_needle, $encoding);\n}\nfunction mb_strwidth($string, $encoding = null)\n{\n\t$s = cfw_mb_sanitize($string);\n\t$re = cfw_mb_wide_regexp();\n\tif ($re === null || !cfw_mb_utf8($encoding)) {\n\t\treturn Mbstring::mb_strwidth($s, $encoding);\n\t}\n\treturn cfw_mb_width($s, $re);\n}\nfunction mb_chr($codepoint, $encoding = null)\n{\n\t$cp = (int) $codepoint;\n\t// the polyfill takes $code %= 0x200000 and encodes whatever falls out, so a surrogate,\n\t// a negative and anything past the last plane all come back as bytes native refuses\n\tif ($cp < 0 || $cp > 0x10ffff || ($cp >= 0xd800 && $cp <= 0xdfff)) {\n\t\treturn false;\n\t}\n\treturn Mbstring::mb_chr($cp, $encoding);\n}\nfunction mb_ord($string, $encoding = null)\n{\n\tif ((string) $string === '') {\n\t\t// single quotes: a double-quoted PHP string would interpolate the $string in the message\n\t\tthrow new ValueError('mb_ord(): Argument #1 ($string) must not be empty');\n\t}\n\treturn Mbstring::mb_ord($string, $encoding);\n}\nfunction mb_scrub($string, $encoding = null)\n{\n\treturn Mbstring::mb_scrub(cfw_mb_sanitize($string), $encoding);\n}\nfunction mb_encode_numericentity($string, $map, $encoding = null, $hex = false)\n{\n\treturn Mbstring::mb_encode_numericentity(cfw_mb_sanitize($string), $map, $encoding, $hex);\n}\nfunction mb_convert_encoding($string, $to_encoding, $from_encoding = null)\n{\n\t// SANITISE ONLY WHEN THE SOURCE IS UTF-8. cfw_mb_sanitize reads its input as UTF-8, so running\n\t// it over SJIS or ISO-8859-1 bytes replaces legal ones with \"?\" before the conversion starts\n\t$utf8In = cfw_mb_utf8($from_encoding) && !is_array($from_encoding);\n\t$one = function ($v) use ($utf8In, $to_encoding, $from_encoding) {\n\t\tif (!is_string($v)) {\n\t\t\treturn $v;\n\t\t}\n\t\tif ($utf8In) {\n\t\t\t$v = cfw_mb_sanitize($v);\n\t\t\t// the substitution is keyed by utf-8 character, so this arm needs a utf-8 source\n\t\t\treturn is_string($to_encoding) ? cfw_mb_encode_subst($v, $to_encoding) : $v;\n\t\t}\n\t\tif (!cfw_mb_utf8($to_encoding) || is_array($from_encoding) || !is_string($from_encoding)) {\n\t\t\treturn $v;\n\t\t}\n\t\t$subst = cfw_mb_decode_subst($v, $from_encoding);\n\t\treturn $subst ?? $v;\n\t};\n\t$clean = is_array($string) ? array_map($one, $string) : $one($string);\n\t// a decoded arm already carries its \"?\" as utf-8, so say so rather than let the polyfill walk\n\t// the source a second time with //IGNORE; otherwise hand it a label its alias table knows\n\t$decoded = !$utf8In && is_string($clean) && cfw_mb_utf8($to_encoding) && $clean !== $string;\n\t$from = $decoded ? 'UTF-8' : ($utf8In ? $from_encoding : cfw_mb_iconv_label($from_encoding));\n\treturn Mbstring::mb_convert_encoding($clean, $to_encoding, $from);\n}\n"