aboutsummaryrefslogtreecommitdiff
path: root/phpBB
diff options
context:
space:
mode:
authorrxu <rxu@mail.ru>2020-01-01 16:38:34 +0700
committerrxu <rxu@mail.ru>2020-01-03 02:21:37 +0700
commit4ed854c8182284acaa9b5ed326b8eb0d2ac32b80 (patch)
tree4d6422c0e1a7ba23782523bc8977430a00c683e0 /phpBB
parentMerge pull request #5809 from marc1706/ticket/16285 (diff)
downloadphpbb-4ed854c8182284acaa9b5ed326b8eb0d2ac32b80.tar.gz
phpbb-4ed854c8182284acaa9b5ed326b8eb0d2ac32b80.tar.bz2
phpbb-4ed854c8182284acaa9b5ed326b8eb0d2ac32b80.zip
[ticket/16288] PHP 8 compatibility
PHPBB3-16288
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/acp/acp_main.php14
-rw-r--r--phpBB/includes/ucp/ucp_pm.php16
-rw-r--r--phpBB/phpbb/search/fulltext_native.php2
-rw-r--r--phpBB/phpbb/template/context.php7
4 files changed, 24 insertions, 15 deletions
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 27fac54777..90f5cae383 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -22,6 +22,7 @@ if (!defined('IN_PHPBB'))
class acp_main
{
var $u_action;
+ private $php_ini;
function main($id, $mode)
{
@@ -684,14 +685,19 @@ class acp_main
$template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002));
}
+ $this->php_ini = $phpbb_container->get('php_ini');
+ $func_overload = $this->php_ini->getNumeric('mbstring.func_overload');
+ $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');
if (extension_loaded('mbstring'))
{
$template->assign_vars(array(
'S_MBSTRING_LOADED' => true,
- 'S_MBSTRING_FUNC_OVERLOAD_FAIL' => (intval(@ini_get('mbstring.func_overload')) & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)),
- 'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => (@ini_get('mbstring.encoding_translation') != 0),
- 'S_MBSTRING_HTTP_INPUT_FAIL' => !in_array(@ini_get('mbstring.http_input'), array('pass', '')),
- 'S_MBSTRING_HTTP_OUTPUT_FAIL' => !in_array(@ini_get('mbstring.http_output'), array('pass', '')),
+ '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', '')),
));
}
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index 4d02620e89..6e7a3acd08 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -354,7 +354,7 @@ class ucp_pm
$template->assign_vars(array(
'CUR_FOLDER_ID' => $folder_id,
- 'CUR_FOLDER_NAME' => $folder_status['folder_name'],
+ 'CUR_FOLDER_NAME' => $folder_status ? $folder_status['folder_name'] : false,
'NUM_NOT_MOVED' => $num_not_moved,
'NUM_REMOVED' => $num_removed,
'RELEASE_MESSAGE_INFO' => sprintf($user->lang['RELEASE_MESSAGES'], '<a href="' . $this->u_action . '&amp;folder=' . $folder_id . '&amp;release=1">', '</a>'),
@@ -377,12 +377,12 @@ class ucp_pm
'S_IN_OUTBOX' => ($folder_id == PRIVMSGS_OUTBOX) ? true : false,
'S_IN_SENTBOX' => ($folder_id == PRIVMSGS_SENTBOX) ? true : false,
- 'FOLDER_STATUS' => $folder_status['message'],
- 'FOLDER_MAX_MESSAGES' => $folder_status['max'],
- 'FOLDER_CUR_MESSAGES' => $folder_status['cur'],
- 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'],
- 'FOLDER_PERCENT' => $folder_status['percent'])
- );
+ 'FOLDER_STATUS' => $folder_status ? $folder_status['message'] : false,
+ 'FOLDER_MAX_MESSAGES' => $folder_status ? $folder_status['max'] : false,
+ 'FOLDER_CUR_MESSAGES' => $folder_status ? $folder_status['cur'] : false,
+ 'FOLDER_REMAINING_MESSAGES' => $folder_status ? $folder_status['remaining'] : false,
+ 'FOLDER_PERCENT' => $folder_status ? $folder_status['percent'] : false,
+ ));
if ($action == 'view_folder')
{
@@ -398,7 +398,7 @@ class ucp_pm
{
$template->assign_vars(array(
'S_VIEW_MESSAGE' => true,
- 'L_RETURN_TO_FOLDER' => $user->lang('RETURN_TO', $folder_status['folder_name']),
+ 'L_RETURN_TO_FOLDER' => $user->lang('RETURN_TO', ($folder_status ? $folder_status['folder_name'] : '')),
'MSG_ID' => $msg_id,
));
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 23460d3381..2246dc0aef 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -405,7 +405,7 @@ class fulltext_native extends \phpbb\search\base
}
// a group of words of which at least one word should be in every resulting post
- if ($word[0] == '(')
+ if (isset($word[0]) && $word[0] == '(')
{
$word = array_unique(explode('|', substr($word, 1, -1)));
}
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index f059c327c1..d98d8b6e28 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -384,7 +384,9 @@ class context
if (is_array($key))
{
// Search array to get correct position
- list($search_key, $search_value) = @each($key);
+ $search_key = key($key);
+ $search_value = current($key);
+
foreach ($block as $i => $val_ary)
{
if ($val_ary[$search_key] === $search_value)
@@ -481,7 +483,8 @@ class context
if (is_array($key))
{
// Search array to get correct position
- list($search_key, $search_value) = @each($key);
+ $search_key = key($key);
+ $search_value = current($key);
$key = null;
foreach ($block as $i => $val_ary)