ID: 48697 Updated by: moriyo...@php.net -Summary: mb_internal_encoding() value gets reset in process Reported By: glen at delfi dot ee Status: Assigned Bug Type: mbstring related Operating System: PLD Linux PHP Version: 5.2.10 Assigned To: moriyoshi New Comment:
Changed summary Previous Comments: ------------------------------------------------------------------------ [2009-07-09 07:21:49] ivan1986 at list dot ru <?php echo mb_internal_encoding()."\n"; mb_internal_encoding('utf-8'); echo mb_internal_encoding()."\n"; parse_str('a=1&b=2'); echo mb_internal_encoding()."\n"; ?> ISO-8859-1 UTF-8 ISO-8859-1 must by ISO-8859-1 UTF-8 UTF-8 ------------------------------------------------------------------------ [2009-06-25 18:06:18] glen at delfi dot ee Description: ------------ setting mbstring internal encoding with mb_internal_encoding() function gets reset at some point with 5.2.10, and mb_strtolower() etc that are called without implicit charset will fail. (calling mb_strtolower() with 2 arguments will succeed. in other speak, such code fails: echo mb_internal_encoding(); -> prints ISO-8859-1 mb_internal_encoding('UTF-8'); echo mb_internal_encoding(); -> prints UTF-8 ... /// some code /// echo mb_internal_encoding(); -> prints ISO-8859-1 if i set the internal encoding via php.ini (ini_set() is fine too), then the problem does not occour. ie such code works ok: echo mb_internal_encoding(); -> prints ISO-8859-1 ini_set("mbstring.internal_encoding", 'UTF-8'); echo mb_internal_encoding(); -> prints UTF-8 ... /// that same code /// echo mb_internal_encoding(); -> prints UTF-8 I have not yet able to create exact php code that is exact reproducer, but the same php code, input data to php script, it works with 5.2.9 and when reverting this commit: http://www.mail-archive.com/php-cvs%40lists.php.net/msg40593.html from brief looking i see that there is some inconsistency, that one code sets the internal encoding from php.ini and the mb_internal_encoding() function does not update php.ini setting. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48697&edit=1