Bug #72992 [Csd]: mbstring.internal_encoding doesn't inherit default_charset

From: Date: Mon, 12 Sep 2016 07:38:53 +0000
Subject: Bug #72992 [Csd]: mbstring.internal_encoding doesn't inherit default_charset
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203970@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72992&edit=1

 ID:                 72992
 Updated by:         yohgaki@php.net
 Reported by:        zoeslam at gmail dot com
 Summary:            mbstring.internal_encoding doesn't inherit
                     default_charset
 Status:             Closed
 Type:               Bug
 Package:            mbstring related
 Operating System:   Ubuntu 16.04
 PHP Version:        7.0.10
 Assigned To:        yohgaki
 Block user comment: N
 Private report:     N

 New Comment:

I noticed mb_internal_encoding() should be modified to reflect encoding actually used... Thank you. 

Anyway, current implementation does not change lower precedence INI values. Used encoding is
determined like (this is iconv because iconv code is simpler)

static char *get_internal_encoding(void) {
	if (ICONVG(internal_encoding) && ICONVG(internal_encoding)[0]) {
		return ICONVG(internal_encoding);
	} else if (PG(internal_encoding) && PG(internal_encoding)[0]) {
		return PG(internal_encoding);
	} else if (SG(default_charset)) {
		return SG(default_charset);
	}
	return "";
}

As you can see, INI setting precedence is kept as defined in the RFC.

Mbstring's encoding handling is not simple as iconv, if I'm missing something please let
me know.


Previous Comments:
------------------------------------------------------------------------
[2016-09-12 06:41:57] zoeslam at gmail dot com

I am sorry I still don't get what you say, but this is not important, I rely on your analysis.

If:
1) "mbstring.internal_encoding" ini setting is deprecated
2) "default_charset" doesn't propagate to mb_internal_encoding()
3) and there is no fix for that

At least the documentation should be updated to report that the only way to change
mb_internal_encoding() is to call mb_internal_encoding() itself.

May we update the manual please?

------------------------------------------------------------------------
[2016-09-12 01:53:01] yohgaki@php.net

Mbstring's INI value is not significant when higher precedence INI is set when mbstring INI is
not set.

------------------------------------------------------------------------
[2016-09-12 01:10:20] yohgaki@php.net

It seems current INI system cannot handler INI propagation at startup well. I wouldn't like to
add ugly hacks. So I leave as it is now. 

Mbstring's INI value is not significant when higher precedence INI is set.

------------------------------------------------------------------------
[2016-09-12 01:10:17] yohgaki@php.net

It seems current INI system cannot handler INI propagation at startup well. I wouldn't like to
add ugly hacks. So I leave as it is now. 

Mbstring's INI value is not significant when higher precedence INI is set.

------------------------------------------------------------------------
[2016-09-10 02:01:38] yohgaki@php.net

I'll just commit INI propagation part of attached patch, too. Then you'll see modified
INIs.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=72992


--
Edit this bug report at https://bugs.php.net/bug.php?id=72992&edit=1


Thread (19 messages)

« previous php.bugs (#203970) next »