-
-
Notifications
You must be signed in to change notification settings - Fork 205
Description
Just ran into this again in another project:
When using any of the iconv or mbstring functions which take a $charset or $encoding parameter in projects which have to be compatible with both PHP <= 5.5 as well as PHP 5.6, in most cases the results will only be the same if that (optional) parameter is set as otherwise the default encoding is used, as taken from the ini settings, and the default changed in PHP 5.6 (to utf-8).
This should be quite easily sniffable by searching for calls to these function and checking whether the parameter is set.
Refs:
Related PHP migration guide entries:
Default character encoding ¶
default_charsetis now used as the default character set for thehtmlentities(),html_entity_decode()andhtmlspecialchars()functions. Note that if the (now deprecated)iconvandmbstringencoding settings are set, they will take precedence overdefault_charsetforiconvandmbstringfunctions, respectively.The default value for this setting is UTF-8.
Ref: https://www.php.net/manual/en/migration56.new-features.php#migration56.new-features.default-encoding
iconv and mbstring encoding settings ¶
The
iconvandmbstringconfiguration options related to encoding have been deprecated in favour ofdefault_charset. The deprecated options are:`iconv.input_encoding` `iconv.output_encoding` `iconv.internal_encoding` `mbstring.http_input` `mbstring.http_output` `mbstring.internal_encoding`