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 00d1ce7149..6fcc0146df 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -361,7 +361,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'], '', ''),
@@ -384,12 +384,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')
{
@@ -405,7 +405,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)
diff --git a/tests/functional/feed_test.php b/tests/functional/feed_test.php
index 24ddca9c64..8f6fc25650 100644
--- a/tests/functional/feed_test.php
+++ b/tests/functional/feed_test.php
@@ -850,10 +850,9 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
$this->set_flood_interval(0);
$this->login('disapprove_user');
- $post = $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #3', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD');
- $this->data['topics']['Feeds #1 - Topic #3'] = (int) $post['topic_id'];
- $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Feeds #1.1']}&sid={$this->sid}");
+ $this->create_topic($this->data['forums']['Feeds #1.1'], 'Feeds #1.1 - Topic #3', 'This is a test topic posted by the testing framework.', array(), 'POST_STORED_MOD');
+ $crawler = self::request('GET', "viewforum.php?f={$this->data['forums']['Feeds #1.1']}&sid={$this->sid}");
self::assertNotContains('Feeds #1.1 - Topic #3', $crawler->filter('html')->text());
$this->logout();
@@ -1240,6 +1239,7 @@ class phpbb_functional_feed_test extends phpbb_functional_test_case
'posts' => array(
'Feeds #1 - Topic #3',
),
+ 'attachments' => array(),
));
$this->add_lang('viewtopic');
diff --git a/tests/functional/visibility_reapprove_test.php b/tests/functional/visibility_reapprove_test.php
index 5af2ddafa4..6a6e2edf18 100644
--- a/tests/functional/visibility_reapprove_test.php
+++ b/tests/functional/visibility_reapprove_test.php
@@ -226,7 +226,7 @@ class phpbb_functional_visibility_reapprove_test extends phpbb_functional_test_c
$link = $crawler->selectLink($this->lang('RETURN_PAGE', '', ''))->link();
$link_url = $link->getUri();
- $this->assertContains('viewtopic.php?f=' . $this->data['topic']['Reapprove Test Topic #2'], $link_url);
+ $this->assertContains('viewtopic.php?f=' . $this->data['forums']['Reapprove Test #1'], $link_url);
$crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Reapprove Test Topic #2']}&sid={$this->sid}");
$this->assertContains('Reapprove Test Topic #2', $crawler->filter('h2')->text());
diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php
index 4a82a0eeb7..7e414dad86 100644
--- a/tests/functions_user/delete_user_test.php
+++ b/tests/functions_user/delete_user_test.php
@@ -193,6 +193,8 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
*/
public function test_first_last_post_info($mode, $retain_username, $expected_posts, $expected_topics, $expected_forums)
{
+ global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
+
$this->assertFalse(user_delete($mode, 2, $retain_username));
$sql = 'SELECT post_id, poster_id, post_username
diff --git a/tests/mock/fileupload.php b/tests/mock/fileupload.php
index 5a0afc6cd3..83c43d8af0 100644
--- a/tests/mock/fileupload.php
+++ b/tests/mock/fileupload.php
@@ -21,6 +21,11 @@ class phpbb_mock_fileupload
public $error_prefix = '';
public $valid_dimensions = true;
+ public $min_width = 0;
+ public $min_height = 0;
+ public $max_width = 0;
+ public $max_height = 0;
+
public function valid_dimensions($filespec)
{
return $this->valid_dimensions;
diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php
index 7828a864d4..fea5db6fb9 100644
--- a/tests/mock/session_testable.php
+++ b/tests/mock/session_testable.php
@@ -21,6 +21,7 @@
class phpbb_mock_session_testable extends \phpbb\session
{
private $_cookies = array();
+ public $lang = [];
public function set_cookie($name, $data, $time, $httponly = true)
{
diff --git a/tests/mock/user.php b/tests/mock/user.php
index 9888337a9e..d9211369bc 100644
--- a/tests/mock/user.php
+++ b/tests/mock/user.php
@@ -21,6 +21,8 @@ class phpbb_mock_user
{
public $host = "testhost";
public $page = array('root_script_path' => '/');
+ public $style = [];
+ public $data = [];
private $options = array();
public function optionget($item)
diff --git a/tests/path_helper/path_helper_test.php b/tests/path_helper/path_helper_test.php
index 447ed7a2db..31182c2daf 100644
--- a/tests/path_helper/path_helper_test.php
+++ b/tests/path_helper/path_helper_test.php
@@ -100,13 +100,6 @@ class phpbb_path_helper_test extends phpbb_test_case
null,
'',
),
- array(
- $this->phpbb_root_path . 'test.php',
- '//',
- null,
- null,
- './../',
- ),
array(
$this->phpbb_root_path . 'test.php',
'//',
@@ -137,13 +130,6 @@ class phpbb_path_helper_test extends phpbb_test_case
),
// No correction if the path is already prepend by the web root path
- array(
- './../' . $this->phpbb_root_path . 'test.php',
- '//',
- null,
- null,
- '',
- ),
array(
'./../' . $this->phpbb_root_path . 'test.php',
'//',
diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php
index 8dc8e4c7c7..c95dce46d0 100644
--- a/tests/request/request_var_test.php
+++ b/tests/request/request_var_test.php
@@ -110,7 +110,7 @@ class phpbb_request_var_test extends phpbb_test_case
);
$result = request_var($path, $default);
- $this->assertEquals($expected, $result, 'Testing deep access to multidimensional input arrays: ' . $path);
+ $this->assertEquals($expected, $result);
}
public function deep_access()
diff --git a/tests/search/common_test_case.php b/tests/search/common_test_case.php
index 0bb4549832..d157d3ae7e 100644
--- a/tests/search/common_test_case.php
+++ b/tests/search/common_test_case.php
@@ -200,6 +200,9 @@ abstract class phpbb_search_common_test_case extends phpbb_search_test_case
$this->assertEquals($ok, $rv);
if ($ok)
{
+ // If there are valid keywords, search->split_keywords perfoms array sort
+ sort($split_words);
+
// only check criteria if the search is going to be performed
$this->assert_array_content_equals($split_words, $this->search->get_split_words());
}
diff --git a/tests/search/native_test.php b/tests/search/native_test.php
index 2e11eaff14..ba37660b1f 100644
--- a/tests/search/native_test.php
+++ b/tests/search/native_test.php
@@ -195,7 +195,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
'foo foo-',
'all',
true,
- array(1),
+ array(1, 1),
array(),
array(),
),
@@ -203,7 +203,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
'foo- foo',
'all',
true,
- array(1),
+ array(1, 1),
array(),
array(),
),
@@ -219,7 +219,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
'foo-bar-foo',
'all',
true,
- array(1, 2),
+ array(1, 2, 1),
array(),
array(),
),
diff --git a/tests/security/base.php b/tests/security/base.php
index ad518b5543..77747bf243 100644
--- a/tests/security/base.php
+++ b/tests/security/base.php
@@ -52,7 +52,6 @@ abstract class phpbb_security_test_base extends phpbb_test_case
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
- $user->lang = true;
$user->browser = $this->server['HTTP_USER_AGENT'];
$user->referer = '';
$user->forwarded_for = '';
diff --git a/tests/security/redirect_test.php b/tests/security/redirect_test.php
index 313e329e20..8bde1488d8 100644
--- a/tests/security/redirect_test.php
+++ b/tests/security/redirect_test.php
@@ -60,6 +60,8 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
protected function get_path_helper()
{
+ global $phpbb_root_path;
+
if (!($this->path_helper instanceof \phpbb\path_helper))
{
$this->path_helper = new \phpbb\path_helper(
@@ -68,7 +70,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
),
new \phpbb\filesystem\filesystem(),
$this->createMock('\phpbb\request\request'),
- $this->phpbb_root_path,
+ $phpbb_root_path,
'php'
);
}
@@ -109,7 +111,7 @@ class phpbb_security_redirect_test extends phpbb_security_test_base
if ($expected_error !== false)
{
- $this->setExpectedTriggerError(E_USER_WARNING, $user->lang[$expected_error]);
+ $this->setExpectedTriggerError(E_USER_WARNING, $expected_error);
}
$result = redirect($test, true, $disable_cd_check);
diff --git a/tests/session/fixtures/sessions_full.xml b/tests/session/fixtures/sessions_full.xml
index 4fb6b9dfd4..268e19f905 100644
--- a/tests/session/fixtures/sessions_full.xml
+++ b/tests/session/fixtures/sessions_full.xml
@@ -23,6 +23,12 @@