From 3ca08ee764a372f65a2469ca72270aef32249a5b Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 31 Mar 2020 10:46:44 +0200 Subject: [PATCH] Make sure mbstring.internal_encoding deprecation is always thrown It was not thrown if the setting was specified via -d at least. --- ext/mbstring/mbstring.c | 6 +++--- ext/mbstring/tests/ini_language.phpt | 4 ++-- ext/mbstring/tests/mb_get_info.phpt | 9 +++++++++ ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt | 3 +++ .../mb_output_handler_runtime_ini_alteration-01.phpt | 2 +- .../mb_output_handler_runtime_ini_alteration-02.phpt | 2 +- ext/mbstring/tests/php_gr_jp_16242.phpt | 4 ++-- 7 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 4f698a7a47..19b7a28703 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -899,7 +899,7 @@ static int _php_mb_ini_mbstring_http_input_set(const char *new_value, size_t new /* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_input) */ static PHP_INI_MH(OnUpdate_mbstring_http_input) { - if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + if (new_value) { php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_input is deprecated"); } @@ -929,7 +929,7 @@ static int _php_mb_ini_mbstring_http_output_set(const char *new_value) { /* {{{ static PHP_INI_MH(OnUpdate_mbstring_http_output) */ static PHP_INI_MH(OnUpdate_mbstring_http_output) { - if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + if (new_value) { php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.http_output is deprecated"); } @@ -973,7 +973,7 @@ static int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, siz /* {{{ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) */ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) { - if (stage & (PHP_INI_STAGE_ACTIVATE | PHP_INI_STAGE_RUNTIME)) { + if (new_value) { php_error_docref("ref.mbstring", E_DEPRECATED, "Use of mbstring.internal_encoding is deprecated"); } diff --git a/ext/mbstring/tests/ini_language.phpt b/ext/mbstring/tests/ini_language.phpt index 1dc94141fa..a41d1b9672 100644 --- a/ext/mbstring/tests/ini_language.phpt +++ b/ext/mbstring/tests/ini_language.phpt @@ -3,11 +3,11 @@ mbstring.language bug --SKIPIF-- --INI-- -mbstring.internal_encoding=Shift_JIS +internal_encoding=Shift_JIS mbstring.language=Japanese --FILE-- --EXPECT-- diff --git a/ext/mbstring/tests/mb_get_info.phpt b/ext/mbstring/tests/mb_get_info.phpt index 4b08b9943f..f1fbfa08fe 100644 --- a/ext/mbstring/tests/mb_get_info.phpt +++ b/ext/mbstring/tests/mb_get_info.phpt @@ -23,6 +23,15 @@ foreach (array_keys($result) as $key) { } ?> --EXPECT-- +PHP Deprecated: PHP Startup: Use of mbstring.http_input is deprecated in Unknown on line 0 +PHP Deprecated: PHP Startup: Use of mbstring.http_output is deprecated in Unknown on line 0 +PHP Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0 + +Deprecated: PHP Startup: Use of mbstring.http_input is deprecated in Unknown on line 0 + +Deprecated: PHP Startup: Use of mbstring.http_output is deprecated in Unknown on line 0 + +Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0 array(13) { ["internal_encoding"]=> string(5) "UTF-8" diff --git a/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt b/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt index af9322c8af..39451dff34 100644 --- a/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt +++ b/ext/mbstring/tests/mb_internal_encoding_ini_basic2.phpt @@ -20,6 +20,9 @@ echo ini_get('mbstring.internal_encoding')."\n"; ?> --EXPECT-- +PHP Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0 + +Deprecated: PHP Startup: Use of mbstring.internal_encoding is deprecated in Unknown on line 0 *** Testing INI mbstring.internal_encoding : basic functionality *** ISO-8859-7 ISO-8859-7 diff --git a/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt b/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt index b7d71f9d23..922dc14af2 100644 --- a/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt +++ b/ext/mbstring/tests/mb_output_handler_runtime_ini_alteration-01.phpt @@ -3,7 +3,7 @@ mb_output_handler() and mbstring.http_output_conv_mimetypes alteration in runtim --SKIPIF-- --INI-- -mbstring.internal_encoding=UTF-8 +internal_encoding=UTF-8 mbstring.http_output_conv_mimetypes=plain --FILE-- --INI-- -mbstring.internal_encoding=UTF-8 +internal_encoding=UTF-8 mbstring.http_output_conv_mimetypes=html --FILE-- --INI-- mbstring.language=Japanese -mbstring.internal_encoding=UTF-8 +internal_encoding=UTF-8 --FILE-- -- 2.50.1