From 6738076f72babe0192e984d2ae94e2a708726ca3 Mon Sep 17 00:00:00 2001
From: 3D-I <480857+3D-I@users.noreply.github.com>
Date: Tue, 15 Dec 2020 14:23:09 +0100
Subject: [PATCH] [ticket/16656] Fix ACP check-in for mbstring http_input &
output
PHPBB3-16656
---
phpBB/adm/style/acp_main.html | 7 +++++++
phpBB/includes/acp/acp_main.php | 14 ++++++++++----
phpBB/language/en/acp/common.php | 6 ++++--
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html
index b8d337cfd8..0c87ed65b4 100644
--- a/phpBB/adm/style/acp_main.html
+++ b/phpBB/adm/style/acp_main.html
@@ -78,6 +78,13 @@
{L_ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN}
+
+ {% if S_DEFAULT_CHARSET_FAIL %}
+
+
{{ lang('ERROR_DEFAULT_CHARSET') }}
+
{{ lang('ERROR_DEFAULT_CHARSET_EXPLAIN') }}
+
+ {% endif %}
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index a46ac2c16f..f79da2e5fe 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -690,16 +690,22 @@ class acp_main
$encoding_translation = $this->php_ini->getString('mbstring.encoding_translation');
$http_input = $this->php_ini->getString('mbstring.http_input');
$http_output = $this->php_ini->getString('mbstring.http_output');
+ $default_charset = $this->php_ini->getString('default_charset');
if (extension_loaded('mbstring'))
{
- $template->assign_vars(array(
+ /**
+ * “mbstring.http_input” and “mbstring.http_output” are deprecated as of PHP 5.6.0
+ * @link https://www.php.net/manual/mbstring.configuration.php#ini.mbstring.http-input
+ */
+ $template->assign_vars([
'S_MBSTRING_LOADED' => true,
'S_MBSTRING_FUNC_OVERLOAD_FAIL' => $func_overload && ($func_overload & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)),
'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => $encoding_translation && ($encoding_translation != 0),
- 'S_MBSTRING_HTTP_INPUT_FAIL' => $http_input && !in_array($http_input, array('pass', '')),
- 'S_MBSTRING_HTTP_OUTPUT_FAIL' => $http_output && !in_array($http_output, array('pass', '')),
- ));
+ 'S_MBSTRING_HTTP_INPUT_FAIL' => !empty($http_input),
+ 'S_MBSTRING_HTTP_OUTPUT_FAIL' => !empty($http_output),
+ 'S_DEFAULT_CHARSET_FAIL' => $default_charset !== 'UTF-8',
+ ]);
}
// Fill dbms version if not yet filled
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 29d0ec5947..64096bbed3 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -371,9 +371,11 @@ $lang = array_merge($lang, array(
'ERROR_MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding is improperly configured',
'ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0. You can check the current value on the PHP information page.',
'ERROR_MBSTRING_HTTP_INPUT' => 'HTTP input character conversion is improperly configured',
- 'ERROR_MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass. You can check the current value on the PHP information page.',
+ 'ERROR_MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be left empty. You can check the current value on the PHP information page.',
'ERROR_MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion is improperly configured',
- 'ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass. You can check the current value on the PHP information page.',
+ 'ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be left empty. You can check the current value on the PHP information page.',
+ 'ERROR_DEFAULT_CHARSET' => 'Default charset is improperly configured',
+ 'ERROR_DEFAULT_CHARSET_EXPLAIN' => 'default_charset must be set to UTF-8. You can check the current value on the PHP information page.',
'FILES_PER_DAY' => 'Attachments per day',
'FORUM_STATS' => 'Board statistics',