-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
| Q | A |
|---|---|
| PHPUnit version | 11.5.44 |
| PHP version | 8.4.7 |
| Installation Method | Composer |
Summary
I want to check encoding of values. So I use function "mb_detect_encoding" without no optional parameters. So the function will use the values of "mbstring.detect_order" via function "mb_detect_order" and "mbstring.strict_detection" from php.ini. However, If i set the values via phpunit.xml, However, when I set the values via phpunit.xml, the value from “mbstring.detect_order” is adopted and can be read via ini_get, but the “mb_detect_order” function still returns the wrong result and so the result of "mb_detect_encoding" isn't correct.
How to reproduce
Setting values in phpunit.xml:
<phpunit>
<php>
<ini name="mbstring.detect_order" value="ISO-8859-1, UTF-8"/>
<ini name="mbstring.strict_detection" value="true"/>
<php>
</phpunit>
Method ini_get('mbstring.detect_order') returns "ISO-8859-1, UTF-8".
Method mb_detect_order() returns php default (an array with values "ASCII" and "UTF-8").
Method mb_detect_encoding(mb_convert_encoding('ÄäÖöÜüß', 'ISO-8859-1', 'UTF-8')) returns "UTF-8".
When using php.ini, the behavior is as follows:
mbstring.detect_order = ISO-8859-1, UTF-8
mbstring.strict_detection = true
Method ini_get('mbstring.detect_order') returns "ISO-8859-1, UTF-8".
Method mb_detect_order() returns also an array with values "ISO-8859-1" and "UTF-8".
Method mb_detect_encoding(mb_convert_encoding('ÄäÖöÜüß', 'ISO-8859-1', 'UTF-8')) returns "ISO-8859-1".