polyfill-mbstring: mb_check_encoding crashes for array input
ondrejmirtes opened this issue · comments
Ondřej Mirtes commented
Hi,
mb_check_encoding
accepts an array of strings: https://3v4l.org/i5MBi
But Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding
crashes with the same input:
Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /Users/ondrej/Development/phpstan/vendor/symfony/polyfill-mbstring/Mbstring.php:440
#0 /Users/ondrej/Development/phpstan/vendor/symfony/polyfill-mbstring/Mbstring.php(440): preg_match('//u', Array)
#1 /Users/ondrej/Development/phpstan/vendor/symfony/polyfill-mbstring/Mbstring.php(416): Symfony\Polyfill\Mbstring\Mbstring::mb_detect_encoding(Array, Array)
#2 /Users/ondrej/Development/phpstan/src/Type/Php/StrCaseFunctionsReturnTypeExtension.php(82): Symfony\Polyfill\Mbstring\Mbstring::mb_check_encoding(Array, 'UTF-8')
Tested with symfony/polyfill-mbstring v1.27.0.
Thanks :)