PHP 5.6: new NewIconvMbstringCharsetDefault sniff by jrfnl · Pull Request #864 · PHPCompatibility/PHPCompatibility
all functions that take encoding option use php.internal_encoding as default (e.g. htmlentities/mb_strlen/mb_regex/etc)
Note: The new sniff will only throw an error when the testVersion indicates that both PHP < 5.6 as well as PHP 5.6+ need to be supported.
Refs:
- https://wiki.php.net/rfc/default_encoding
- https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.default-encoding
- https://www.php.net/manual/en/migration56.deprecated.php#migration56.deprecated.iconv-mbstring-encoding
Includes unit tests.
Fixes #839
Notes
This PR does not address the mb_erg..() functions. For those to work correctly cross-version the encoding needs to be set using the mb_regex_encoding() function.
As PHPCS cannot determine whether this has already been done in another file/scope, sniffing for this would yield too many false positives.