Skip to content

Commit 3ca08ee

Browse files
committed
Make sure mbstring.internal_encoding deprecation is always thrown
It was not thrown if the setting was specified via -d at least.
1 parent 47918bd commit 3ca08ee

7 files changed

+21
-9
lines changed

ext/mbstring/mbstring.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ static int _php_mb_ini_mbstring_http_input_set(const char *new_value, size_t new
899899
/* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_input) */
900900
static PHP_INI_MH(OnUpdate_mbstring_http_input)
901901
{
902-
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
902+
if (new_value) {
903903
php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_input is deprecated");
904904
}
905905

@@ -929,7 +929,7 @@ static int _php_mb_ini_mbstring_http_output_set(const char *new_value) {
929929
/* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_output) */
930930
static PHP_INI_MH(OnUpdate_mbstring_http_output)
931931
{
932-
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
932+
if (new_value) {
933933
php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_output is deprecated");
934934
}
935935

@@ -973,7 +973,7 @@ static int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, siz
973973
/* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */
974974
static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
975975
{
976-
if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) {
976+
if (new_value) {
977977
php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.internal_encoding is deprecated");
978978
}
979979

ext/mbstring/tests/ini_language.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ mbstring.language bug
33
--SKIPIF--
44
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
55
--INI--
6-
mbstring.internal_encoding=Shift_JIS
6+
internal_encoding=Shift_JIS
77
mbstring.language=Japanese
88
--FILE--
99
<?php
10-
var_dump(ini_get('mbstring.internal_encoding'));
10+
var_dump(ini_get('internal_encoding'));
1111
var_dump(mb_internal_encoding());
1212
?>
1313
--EXPECT--

ext/mbstring/tests/mb_get_info.phpt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ foreach (array_keys($result) as $key) {
2323
}
2424
?>
2525
--EXPECT--
26+
PHP Deprecated: PHP Startup: Use of mbstring.http_input is deprecated in Unknown on line 0
27+
PHP Deprecated: PHP Startup: Use of mbstring.http_output is deprecated in Unknown on line 0
28+
PHP Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0
29+
30+
Deprecated: PHP Startup: Use of mbstring.http_input is deprecated in Unknown on line 0
31+
32+
Deprecated: PHP Startup: Use of mbstring.http_output is deprecated in Unknown on line 0
33+
34+
Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0
2635
array(13) {
2736
["internal_encoding"]=>
2837
string(5) "UTF-8"

ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ echo ini_get('mbstring.internal_encoding')."\n";
2020

2121
?>
2222
--EXPECT--
23+
PHP Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0
24+
25+
Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0
2326
*** Testing INI mbstring.internal_encoding : basic functionality ***
2427
ISO-8859-7
2528
ISO-8859-7

ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mb_output_handler() and mbstring.http_output_conv_mimetypes alteration in runtim
33
--SKIPIF--
44
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
55
--INI--
6-
mbstring.internal_encoding=UTF-8
6+
internal_encoding=UTF-8
77
mbstring.http_output_conv_mimetypes=plain
88
--FILE--
99
<?php

ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-02.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mb_output_handler() and mbstring.http_output_conv_mimetypes alteration in runtim
33
--SKIPIF--
44
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
55
--INI--
6-
mbstring.internal_encoding=UTF-8
6+
internal_encoding=UTF-8
77
mbstring.http_output_conv_mimetypes=html
88
--FILE--
99
<?php

ext/mbstring/tests/php_gr_jp_16242.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ extension_loaded('mbstring') or die('skip mbstring not available');
66
?>
77
--INI--
88
mbstring.language=Japanese
9-
mbstring.internal_encoding=UTF-8
9+
internal_encoding=UTF-8
1010
--FILE--
1111
<?php
1212

1313
var_dump(ini_get('mbstring.language'));
14-
var_dump(ini_get('mbstring.internal_encoding'));
14+
var_dump(ini_get('internal_encoding'));
1515
var_dump(mb_internal_encoding());
1616

1717
?>

0 commit comments

Comments
 (0)