php.net |  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
Votes:15
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: glen at delfi dot ee
New email:
PHP Version: OS:

 

 [2009-06-25 18:06 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-09 07:21 UTC] 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-09-14 00:09 UTC] moriyoshi@php.net
Changed summary
 [2009-09-14 04:11 UTC] svn@php.net
Automatic comment from SVN on behalf of moriyoshi
Revision: http://svn.php.net/viewvc/?view=revision&revision=288301
Log: - Looks like bug #48697 has already been fixed in RC1.
 [2009-09-14 04:11 UTC] moriyoshi@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2009-09-14 04:12 UTC] moriyoshi@php.net
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 
root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64).
 [2011-02-20 13:07 UTC] mailinator at mailinator dot com
This bug is still present in php5.3.4
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 20:01:30 2024 UTC