|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48697 mb_internal_encoding() value gets reset by parse_str()
Submitted: 2009-06-25 18:06 UTC Modified: 2009-09-14 05:20 UTC
Avg. Score:4.5 ± 0.7
Reproduced:15 of 15 (100.0%)
Same Version:10 (66.7%)
Same OS:4 (26.7%)
From: glen at delfi dot ee Assigned: moriyoshi (profile)
Status: Closed Package: mbstring related
PHP Version: 5.2.10 OS: PLD Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: glen at delfi dot ee
New email:
PHP Version: OS:


 [2009-06-25 18:06 UTC] glen at delfi dot ee
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
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:

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-09 07:21 UTC] ivan1986 at list dot ru

echo mb_internal_encoding()."\n";
echo mb_internal_encoding()."\n";


echo mb_internal_encoding()."\n";



must by

 [2009-09-14 00:09 UTC]
Changed summary
 [2009-09-14 04:11 UTC]
Automatic comment from SVN on behalf of moriyoshi
Log: - Looks like bug #48697 has already been fixed in RC1.
 [2009-09-14 04:11 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2009-09-14 04:12 UTC]
Changed the summary again as it turned out mb_parse_str() has nothing to do with this.
 [2009-09-14 05:18 UTC] glen at delfi dot ee
blah, why you never include scm commit in the bug? would be helpful instead have to dig myself....
 [2009-09-14 05:20 UTC] glen at delfi dot ee
nevermind, disregard my last post, seems commit is posted to bug, just not mailed to bug subscribers...
 [2010-03-12 10:18 UTC] jan dot hancic at gmail dot com
This bug is still present in version 5.2.10 (FreeBSD XXXX 7.2-RELEASE FreeBSD 7.2-
RELEASE #0: Fri May 1 07:18:07 UTC 2009 amd64).
 [2011-02-20 13:07 UTC] mailinator at mailinator dot com
This bug is still present in php5.3.4
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 10 18:05:46 2022 UTC