Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Only mb_convert_encoding in StringHelper sanitizeUTF8 (#2994)
* Test if UConverter Exists Without Autoload Fix #2982. That issue is actually closed, but it did expose a problem. Our test environments all enable php-intl, but that extension isn't a formal requirement for PhpSpreadsheet. Perhaps it ought to be. Nevertheless ... Using UConverter for string translation solved some problems for us. However, it is only available when php-intl is enabled. The code tests if it exists before using it, so no big deal ... except it seems likely that the people reporting the issue not only did not have php-intl, but they do have their own autoloader which issues an exception when the class isn't found. The test for existence of UConverter defaulted to attempting to autoload it if not found. So, on a system without php-intl but with a custom autoloader, there is a problem. Code is changed to suppress autoload when testing UConverter existence. Pending this fix, the workaround for this issue is to enable php-intl. * Minor Improvement Make mb_convert_encoding use same substitution character as UConverter, ensuring consistent results whatever the user's environment. * And Now That I Figured That Out Since mb_convert_encoding can now return the same output as UConverter, we don't need UConverter (or iconv) after all in sanitizeUTF8.
- Loading branch information