aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/docs/INSTALL.html34
-rw-r--r--phpBB/docs/sphinx.sample.conf1
-rw-r--r--phpBB/includes/functions_module.php2
-rw-r--r--phpBB/includes/mcp/mcp_topic.php4
-rw-r--r--phpBB/includes/message_parser.php3
-rw-r--r--phpBB/phpbb/feed/controller/feed.php7
-rw-r--r--phpBB/phpbb/passwords/driver/argon2i.php21
-rw-r--r--phpBB/phpbb/search/fulltext_native.php2
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php1
-rw-r--r--phpBB/search.php5
-rw-r--r--tests/bbcode/parser_test.php1
-rw-r--r--tests/console/cron/run_test.php4
-rw-r--r--tests/console/user/base.php3
-rw-r--r--tests/content_visibility/delete_post_test.php2
-rw-r--r--tests/controller/common_helper_route.php2
-rw-r--r--tests/files/types_base_test.php2
-rw-r--r--tests/functions/obtain_online_test.php1
-rw-r--r--tests/functions/validate_username_test.php4
-rw-r--r--tests/functions_user/delete_user_test.php23
-rw-r--r--tests/functions_user/group_user_attributes_test.php1
-rw-r--r--tests/log/delete_test.php2
-rw-r--r--tests/log/function_view_log_test.php2
-rw-r--r--tests/migrator/get_callable_from_step_test.php3
-rw-r--r--tests/migrator/schema_generator_test.php4
-rw-r--r--tests/passwords/drivers_test.php58
25 files changed, 133 insertions, 59 deletions
diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html
index fbc701a2ca..7d759b42f0 100644
--- a/phpBB/docs/INSTALL.html
+++ b/phpBB/docs/INSTALL.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="keywords" content="" />
-<meta name="description" content="phpBB 3.3.x Installation, updating and conversion informations" />
+<meta name="description" content="phpBB 3.3.x Installation, updating and conversion information" />
<title>phpBB &bull; Install</title>
<link href="assets/css/stylesheet.css" rel="stylesheet" type="text/css" media="screen" />
@@ -22,7 +22,7 @@
<div id="doc-description">
<a href="../index.php" id="logo"><img src="assets/images/site_logo.gif" alt="" /></a>
<h1>phpBB 3.3.x Install</h1>
- <p>phpBB 3.3.x Installation, updating and conversion informations</p>
+ <p>phpBB 3.3.x Installation, updating and conversion information</p>
<p style="display: none;"><a href="#start_here">Skip</a></p>
</div>
@@ -101,18 +101,18 @@
<div class="content">
- <p>If you have basic knowledge of using FTP and are sure your hosting service or server will run phpBB3 you can use these steps to quickly get started. For a more detailed explanation you should skip this and go to <a href="#require">section 2</a> below.</p>
+ <p>If you have basic knowledge of using FTP and are sure your hosting service or server will run phpBB you can use these steps to quickly get started. For a more detailed explanation you should skip this and go to <a href="#require">section 2</a> below.</p>
<ol>
- <li>Decompress the phpBB3 archive to a local directory on your system.</li>
+ <li>Decompress the phpBB archive to a local directory on your system.</li>
<li>Upload all the files contained in this archive (retaining the directory structure) to a web accessible directory on your server or hosting account.</li>
<li>Change the permissions on config.php to be writable by all (666 or -rw-rw-rw- within your FTP Client)</li>
<li>Change the permissions on the following directories to be writable by all (777 or -rwxrwxrwx within your FTP Client):<br />
<code>store/</code>, <code>cache/</code>, <code>files/</code> and <code>images/avatars/upload/</code>.</li>
- <li>Point your web browser to the location where you uploaded the phpBB3 files with the addition of <code>install/app.php</code> or simply <code>install/</code>, e.g. <code>http://www.example.com/phpBB3/install/app.php</code>, <code>http://www.example.com/forum/install/</code>.</li>
+ <li>Point your web browser to the location where you uploaded the phpBB files with the addition of <code>install/app.php</code> or simply <code>install/</code>, e.g. <code>http://www.example.com/phpBB3/install/app.php</code>, <code>http://www.example.com/forum/install/</code>.</li>
<li>Click the <strong><em>INSTALL</em></strong> tab, follow the steps and fill out all the requested information.</li>
<li>Change the permissions on config.php to be writable only by yourself (644 or -rw-r--r-- within your FTP Client)</li>
- <li>phpBB3 should now be available, please <strong>MAKE SURE</strong> you read at least <a href="#postinstall">Section 6</a> below for important, security related post-installation instructions, and also take note of <a href="#anti_spam">Section 7</a> regarding anti-spam measures.</li>
+ <li>phpBB should now be available, please <strong>MAKE SURE</strong> you read at least <a href="#postinstall">Section 6</a> below for important, security related post-installation instructions, and also take note of <a href="#anti_spam">Section 7</a> regarding anti-spam measures.</li>
</ol>
<p>If you experienced problems or do not know how to proceed with any of the steps above please read the rest of this document.</p>
@@ -133,7 +133,7 @@
<div class="content">
- <p>phpBB 3.2.x has a few requirements which must be met before you are able to install and use it.</p>
+ <p>phpBB 3.3.x has a few requirements which must be met before you are able to install and use it.</p>
<ul>
<li>A webserver or web hosting account running on any major Operating System with support for PHP</li>
@@ -147,7 +147,7 @@
<li>Oracle</li>
</ul>
</li>
- <li><strong>PHP 7.1.0+</strong> up to and including <strong>PHP 7.4</strong> with support for the database you intend to use.</li>
+ <li><strong>PHP 7.1.3+</strong> up to and including <strong>PHP 7.4</strong> with support for the database you intend to use.</li>
<li>The following PHP modules are required:
<ul>
<li>json</li>
@@ -353,7 +353,7 @@
<li>(The <code>ext/</code> directory</li>
</ul></li>
- <li>Upload the contents of the 3.3.x Full Package into your forum's directory. Make sure the root level .htaccess file is included in the upload.</li>
+ <li>Upload the contents of the 3.3.x Full Package (<strong>except</strong> for config.php) into your forum's directory. Make sure the root level .htaccess file is included in the upload.</li>
<li>Browse to <code>/install/app.php/update</code></li>
<li>Read the notice <em>Update database only</em> and press <strong>Submit</strong></li>
<li>Delete the <code>install/</code> directory</li>
@@ -374,21 +374,21 @@
<div class="content">
-<p>This paragraph explains the steps necessary to convert your existing phpBB2 installation to phpBB3.</p>
+<p>This paragraph explains the steps necessary to convert your existing phpBB2 installation to phpBB 3.x.</p>
<a name="prereq"></a><h3>5.i. Requirements before converting</h3>
- <p>Before converting, we heavily recommend you do a <em>full backup of your database and files</em>! If you are unsure how to achieve this, please ask your hosting provider for advice. You basically need to follow the instructions given for <a href="#install">New installations</a>. Please <strong>do not</strong> overwrite any old files - install phpBB3 at a different location.</p>
+ <p>Before converting, we heavily recommend you do a <em>full backup of your database and files</em>! If you are unsure how to achieve this, please ask your hosting provider for advice. You basically need to follow the instructions given for <a href="#install">New installations</a>. Please <strong>do not</strong> overwrite any old files - install phpBB 3.x at a different location.</p>
- <p>Once you made a backup of everything and also have a brand new phpBB3 installation, you can now begin the conversion.</p>
+ <p>Once you made a backup of everything and also have a brand new phpBB 3.x installation, you can now begin the conversion.</p>
- <p>Note that the conversion requires <code>CREATE</code> and <code>DROP</code> privileges for the phpBB3 database user account.</p>
+ <p>Note that the conversion requires <code>CREATE</code> and <code>DROP</code> privileges for the phpBB 3.x database user account.</p>
<a name="conversion"></a><h3>5.ii. Converting</h3>
- <p>To begin the conversion, visit the <code>install/</code> folder of your phpBB3 installation (the same as you have done for installing). Now you will see a new tab <em>Convert</em>. Click this tab.</p>
+ <p>To begin the conversion, visit the <code>install/</code> folder of your phpBB 3.x installation (the same as you have done for installing). Now you will see a new tab <em>Convert</em>. Click this tab.</p>
- <p>As with install, the conversion is automated. Your previous 2.0.x database tables will not be changed and the original 2.0.x files will remain unaltered. The conversion is actually only filling your phpBB3 database tables and copying additional data over to your phpBB3 installation. This has the benefit that if something goes wrong, you are able to either re-run the conversion or continue a conversion, while your old board is still accessible. We really recommend that you disable your old installation while converting, else you may have inconsistent data after the conversion.</p>
+ <p>As with install, the conversion is automated. Your previous 2.0.x database tables will not be changed and the original 2.0.x files will remain unaltered. The conversion is actually only filling your phpBB 3.x database tables and copying additional data over to your phpBB 3.x installation. This has the benefit that if something goes wrong, you are able to either re-run the conversion or continue a conversion, while your old board is still accessible. We really recommend that you disable your old installation while converting, else you may have inconsistent data after the conversion.</p>
<p>Please note that this conversion process may take quite some time and depending on your hosting provider this may result in it failing (due to web server resource limits or other timeout issues). If this is the case, you should ask your provider if they are willing to allow the convert script to temporarily exceed their limits (be nice and they will probably be quite helpful). If your host is unwilling to increase the limits to run the convertor, please see this article for performing the conversion on your local machine: <a href="https://www.phpbb.com/kb/article/offline-conversions/">Knowledge Base - Offline Conversions</a></p>
@@ -412,9 +412,9 @@
<p><strong>http 500 / white pages</strong> The conversion is a load-heavy procedure. Restrictions imposed by some server hosting providers can cause problems. The most common causes are: values too low for the PHP settings <code>memory_limit</code> and <code>max_execution_time</code>. Limits on the allowed CPU time are also a frequent cause for such errors, as are limits on the number of database queries allowed. If you cannot change such settings, then contact your hosting provider or run the conversion procedure on a different computer. The phpBB.com forums are also an excellent location to ask for support.</p>
- <p><strong>Password conversion</strong> Due to the utf-8 based handling of passwords in phpBB3, it is not always possible to transfer all passwords. For passwords "lost in translation" the easiest workaround is to use the <em>I forgot my password</em> link on the login page.</p>
+ <p><strong>Password conversion</strong> Due to the utf-8 based handling of passwords in phpBB 3.x, it is not always possible to transfer all passwords. For passwords "lost in translation" the easiest workaround is to use the <em>I forgot my password</em> link on the login page.</p>
- <p><strong>Path to your former board</strong> The convertor expects the relative path to your old board's files. So, for instance, if the old board is located at <code>http://www.yourdomain.com/forum</code> and the phpBB3 installation is located at <code>http://www.yourdomain.com/phpBB3</code>, then the correct value would be <code>../forum</code>. Note that the webserver user must be able to access the source installation's files.</p>
+ <p><strong>Path to your former board</strong> The convertor expects the relative path to your old board's files. So, for instance, if the old board is located at <code>http://www.yourdomain.com/forum</code> and the phpBB 3.x installation is located at <code>http://www.yourdomain.com/phpBB3</code>, then the correct value would be <code>../forum</code>. Note that the webserver user must be able to access the source installation's files.</p>
<p><strong>Missing images</strong> If your default board language's language pack does not include all images, then some images might be missing in your installation. Always use a complete language pack as default language.</p>
diff --git a/phpBB/docs/sphinx.sample.conf b/phpBB/docs/sphinx.sample.conf
index bf7c4a43a8..d7f2fd782c 100644
--- a/phpBB/docs/sphinx.sample.conf
+++ b/phpBB/docs/sphinx.sample.conf
@@ -74,6 +74,7 @@ index index_phpbb_{SPHINX_ID}_main
charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF
min_prefix_len = 0
min_infix_len = 0
+ html_strip = 1
}
index index_phpbb_{SPHINX_ID}_delta : index_phpbb_{SPHINX_ID}_main
{
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 510d98ec11..e90c11f884 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -445,7 +445,7 @@ class p_master
break;
default:
- if (!preg_match('#(?:' . implode(array_keys($valid_tokens), ')|(?:') . ')#', $token))
+ if (!preg_match('#(?:' . implode(')|(?:', array_keys($valid_tokens)) . ')#', $token))
{
$token = '';
}
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 83ad56f3e4..77db5f3ed0 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -242,7 +242,7 @@ function mcp_topic_view($id, $mode, $action)
);
extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars)));
- foreach ($rowset as $i => $row)
+ foreach ($rowset as $current_row_number => $row)
{
$message = $row['post_text'];
$post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title'];
@@ -336,7 +336,7 @@ function mcp_topic_view($id, $mode, $action)
}
}
- unset($rowset[$i]);
+ unset($rowset[$current_row_number]);
}
// Display topic icons for split topic
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index e1c28223dc..d6214c4614 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -46,6 +46,7 @@ class bbcode_firstpass extends bbcode
var $message = '';
var $warn_msg = array();
var $parsed_items = array();
+ var $mode;
/**
* Parse BBCode
@@ -1128,8 +1129,6 @@ class parse_message extends bbcode_firstpass
var $allow_quote_bbcode = true;
var $allow_url_bbcode = true;
- var $mode;
-
/**
* The plupload object used for dealing with attachments
* @var \phpbb\plupload\plupload
diff --git a/phpBB/phpbb/feed/controller/feed.php b/phpBB/phpbb/feed/controller/feed.php
index c0d7bc72ec..7826d19042 100644
--- a/phpBB/phpbb/feed/controller/feed.php
+++ b/phpBB/phpbb/feed/controller/feed.php
@@ -308,14 +308,13 @@ class feed
* Event to modify the feed row
*
* @event core.feed_modify_feed_row
- * @var int forum_id Forum ID
- * @var string mode Feeds mode (forums|topics|topics_new|topics_active|news)
+ * @var feed_interface feed Feed instance
* @var array row Array with feed data
- * @var int topic_id Topic ID
*
* @since 3.1.10-RC1
+ * @changed 3.3.0 Replace forum_id, mode, topic_id with feed instance
*/
- $vars = array('forum_id', 'mode', 'row', 'topic_id');
+ $vars = array('feed', 'row');
extract($this->phpbb_dispatcher->trigger_event('core.feed_modify_feed_row', compact($vars)));
// BBCode options to correctly disable urls, smilies, bbcode...
diff --git a/phpBB/phpbb/passwords/driver/argon2i.php b/phpBB/phpbb/passwords/driver/argon2i.php
index 49d7d6393e..bf4d6ec33a 100644
--- a/phpBB/phpbb/passwords/driver/argon2i.php
+++ b/phpBB/phpbb/passwords/driver/argon2i.php
@@ -37,10 +37,23 @@ class argon2i extends base_native
{
parent::__construct($config, $helper);
- // Don't allow cost factors to be below default settings
- $this->memory_cost = max($memory_cost, 1024);
- $this->threads = max($threads, 2);
- $this->time_cost = max($time_cost, 2);
+ // Workaround to prevent "Use of undefined constant" warning on some unsupported PHP installations
+ if (!defined('PASSWORD_ARGON2I'))
+ {
+ define('PASSWORD_ARGON2_DEFAULT_MEMORY_COST', 1024);
+ define('PASSWORD_ARGON2_DEFAULT_TIME_COST', 2);
+ define('PASSWORD_ARGON2_DEFAULT_THREADS', 1);
+ }
+
+ /**
+ * For Sodium implementation of argon2 algorithm (since PHP 7.4), set special value of 1 for "threads" cost factor
+ * See https://wiki.php.net/rfc/sodium.argon.hash and PHPBB3-16266
+ * Don't allow cost factors to be below default settings where possible
+ */
+ $this->memory_cost = max($memory_cost, PASSWORD_ARGON2_DEFAULT_MEMORY_COST);
+ $this->time_cost = max($time_cost, PASSWORD_ARGON2_DEFAULT_TIME_COST);
+ $this->threads = (defined('PASSWORD_ARGON2_PROVIDER') && PASSWORD_ARGON2_PROVIDER == 'sodium') ?
+ PASSWORD_ARGON2_DEFAULT_THREADS : max($threads, PASSWORD_ARGON2_DEFAULT_THREADS);
}
/**
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 63ac242ea2..23460d3381 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -788,6 +788,8 @@ class fulltext_native extends \phpbb\search\base
$must_not_contain_ids = $this->must_not_contain_ids;
$must_contain_ids = $this->must_contain_ids;
+ $sql_sort_table = $sql_sort_join = $sql_match = $sql_match_where = $sql_sort = '';
+
/**
* Allow changing the query used for counting for posts using fulltext_native
*
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index f7dcd5d937..d2e12fd7c0 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -335,6 +335,7 @@ class fulltext_sphinx
array('charset_table', 'U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF'),
array('min_prefix_len', '0'),
array('min_infix_len', '0'),
+ array('html_strip', '1'),
),
'index index_phpbb_' . $this->id . '_delta : index_phpbb_' . $this->id . '_main' => array(
array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_delta'),
diff --git a/phpBB/search.php b/phpBB/search.php
index bd8025dae5..5d5e9f5f8a 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -1079,6 +1079,10 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$view_topic_url_params = "f=$forum_id&amp;t=$result_topic_id" . (($u_hilit) ? "&amp;hilit=$u_hilit" : '');
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
+ $folder_img = $folder_alt = $u_mcp_queue = '';
+ $topic_type = $posts_unapproved = 0;
+ $unread_topic = $topic_unapproved = $topic_deleted = false;
+
if ($show_results == 'topics')
{
if ($config['load_db_track'] && $author_id === $user->data['user_id'])
@@ -1086,7 +1090,6 @@ if ($keywords || $author || $author_id || $search_id || $submit)
$row['topic_posted'] = 1;
}
- $folder_img = $folder_alt = $topic_type = '';
topic_status($row, $replies, (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false, $folder_img, $folder_alt, $topic_type);
$unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false;
diff --git a/tests/bbcode/parser_test.php b/tests/bbcode/parser_test.php
index b569d371f1..6e1fad9ad1 100644
--- a/tests/bbcode/parser_test.php
+++ b/tests/bbcode/parser_test.php
@@ -255,6 +255,7 @@ class phpbb_bbcode_parser_test extends \phpbb_test_case
$symfony_request = new \phpbb\symfony_request($request);
$bbcode = new bbcode_firstpass();
+ $bbcode->mode = 'post';
$bbcode->message = $message;
$bbcode->bbcode_init(false);
$bbcode->parse_bbcode();
diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php
index 2744bf132c..8402f9dd3e 100644
--- a/tests/console/cron/run_test.php
+++ b/tests/console/cron/run_test.php
@@ -122,6 +122,8 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function test_no_task()
{
+ global $phpbb_root_path, $phpEx;
+
$tasks = array(
);
@@ -163,6 +165,8 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
public function test_no_task_verbose()
{
+ global $phpbb_root_path, $phpEx;
+
$tasks = array(
);
diff --git a/tests/console/user/base.php b/tests/console/user/base.php
index b845ab1639..74f04cf686 100644
--- a/tests/console/user/base.php
+++ b/tests/console/user/base.php
@@ -112,7 +112,8 @@ abstract class phpbb_console_user_base extends phpbb_database_test_case
$row = $this->db->sql_fetchrow($result);
$this->db->sql_freeresult($result);
- return $row['user_id'];
+ $user_id = $row ? $row['user_id'] : null;
+ return $user_id;
}
public function getInputStream($input)
diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php
index 4f978219c2..1c1796a1fc 100644
--- a/tests/content_visibility/delete_post_test.php
+++ b/tests/content_visibility/delete_post_test.php
@@ -287,7 +287,7 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
*/
public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user)
{
- global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
+ global $auth, $cache, $config, $db, $user, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$config = new \phpbb\config\config(array(
'num_posts' => 3,
diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php
index 447c10d10e..bdaf8ee682 100644
--- a/tests/controller/common_helper_route.php
+++ b/tests/controller/common_helper_route.php
@@ -74,7 +74,7 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case
protected function generate_route_objects()
{
- global $request;
+ global $request, $phpbb_root_path, $phpEx;
$this->request = new phpbb_mock_request();
$this->request->overwrite('SCRIPT_NAME', $this->get_uri(), \phpbb\request\request_interface::SERVER);
diff --git a/tests/files/types_base_test.php b/tests/files/types_base_test.php
index a5533f2bc0..28c5a12c3d 100644
--- a/tests/files/types_base_test.php
+++ b/tests/files/types_base_test.php
@@ -79,6 +79,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
$php_ini->expects($this->any())
->method('getString')
->willReturn($max_filesize);
+ $upload = new \phpbb\files\upload($this->filesystem, $this->factory, $this->language, $php_ini, $this->request);
$type_form = new \phpbb\files\types\local($this->factory, $this->language, $php_ini, $this->request);
$file = $this->getMockBuilder('\phpbb\files\filespec')
->disableOriginalConstructor()
@@ -86,6 +87,7 @@ class phpbb_files_types_base_test extends phpbb_test_case
$file->expects($this->any())
->method('get')
->willReturn($filename);
+ $type_form->set_upload($upload);
$type_form->check_upload_size($file);
$this->assertSame($expected, $file->error);
diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php
index f740decab8..e6929b1549 100644
--- a/tests/functions/obtain_online_test.php
+++ b/tests/functions/obtain_online_test.php
@@ -161,6 +161,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
global $config, $user, $auth, $phpbb_dispatcher;
$config['load_online_guests'] = $display_guests;
$user = new phpbb_mock_lang();
+ $user->data['user_id'] = 100;
$user->lang = $this->load_language();
$auth = $this->createMock('\phpbb\auth\auth');
$acl_get_map = array(
diff --git a/tests/functions/validate_username_test.php b/tests/functions/validate_username_test.php
index 3a4b63b5e8..31837f015b 100644
--- a/tests/functions/validate_username_test.php
+++ b/tests/functions/validate_username_test.php
@@ -130,11 +130,13 @@ class phpbb_functions_validate_data_test extends phpbb_database_test_case
*/
public function test_validate_username($allow_name_chars, $expected)
{
- global $cache, $config, $db;
+ global $cache, $config, $db, $user;
$db = $this->db;
$cache = $this->cache;
$cache->put('_disallowed_usernames', array('barfoo'));
+ $user = new phpbb_mock_user();
+ $user->data['username_clean'] = 'username';
$config['allow_name_chars'] = $allow_name_chars;
diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php
index c112a0c368..4a82a0eeb7 100644
--- a/tests/functions_user/delete_user_test.php
+++ b/tests/functions_user/delete_user_test.php
@@ -23,9 +23,14 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
{
parent::setUp();
- global $cache, $config, $db, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path;
+ global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_root_path, $phpEx;
$db = $this->db = $this->new_dbal();
+
+ $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');
+
$config = new \phpbb\config\config(array(
'load_online_time' => 5,
'search_type' => '\phpbb\search\fulltext_mysql',
@@ -59,16 +64,16 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
array(
'retain', false,
array(
- array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => ''),
+ array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => 'Guest'),
array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'),
- array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => ''),
+ array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => 'Guest'),
array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'),
),
array(
array(
'topic_id' => 1,
- 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '',
- 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '',
+ 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Guest', 'topic_first_poster_colour' => '',
+ 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Guest', 'topic_last_poster_colour' => '',
),
array(
'topic_id' => 2,
@@ -77,8 +82,8 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
),
array(
'topic_id' => 3,
- 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '',
- 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '',
+ 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Guest', 'topic_first_poster_colour' => '',
+ 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Guest', 'topic_last_poster_colour' => '',
),
array(
'topic_id' => 4,
@@ -87,9 +92,9 @@ class phpbb_functions_user_delete_user_test extends phpbb_database_test_case
),
),
array(
- array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''),
+ array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Guest', 'forum_last_poster_colour' => ''),
array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''),
- array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''),
+ array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Guest', 'forum_last_poster_colour' => ''),
array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''),
),
),
diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php
index 6968b1cd3a..dd86d23b34 100644
--- a/tests/functions_user/group_user_attributes_test.php
+++ b/tests/functions_user/group_user_attributes_test.php
@@ -131,6 +131,7 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes
$user = new phpbb_mock_user;
$user->ip = '';
+ $user->data['user_id'] = $user_id;
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php
index 503e2c2fca..fd8a2cb3df 100644
--- a/tests/log/delete_test.php
+++ b/tests/log/delete_test.php
@@ -22,7 +22,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case
protected function setUp(): void
{
- global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth;
+ global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth, $user;
$db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php
index c26644088e..edab371769 100644
--- a/tests/log/function_view_log_test.php
+++ b/tests/log/function_view_log_test.php
@@ -411,6 +411,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
2 => 'plural (%d)',
),
);
+ $user->session_id = false;
+ $user->data['user_id'] = 10;
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
diff --git a/tests/migrator/get_callable_from_step_test.php b/tests/migrator/get_callable_from_step_test.php
index f08caf3181..b0abb6199c 100644
--- a/tests/migrator/get_callable_from_step_test.php
+++ b/tests/migrator/get_callable_from_step_test.php
@@ -15,7 +15,7 @@ class get_callable_from_step_test extends phpbb_database_test_case
{
public function setUp(): void
{
- global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log;
+ global $phpbb_root_path, $php_ext, $table_prefix, $phpbb_log, $user;
parent::setUp();
@@ -24,6 +24,7 @@ class get_callable_from_step_test extends phpbb_database_test_case
$factory = new \phpbb\db\tools\factory();
$cache_service = $this->getMockBuilder('\phpbb\cache\service')->disableOriginalConstructor()->getMock();
$user = $this->getMockBuilder('\phpbb\user')->disableOriginalConstructor()->getMock();
+ $user->ip = '127.0.0.1';
$module_manager = new \phpbb\module\module_manager(
$this->getMockBuilder('\phpbb\cache\driver\dummy')->disableOriginalConstructor()->getMock(),
$db,
diff --git a/tests/migrator/schema_generator_test.php b/tests/migrator/schema_generator_test.php
index 88257430a7..1349b98953 100644
--- a/tests/migrator/schema_generator_test.php
+++ b/tests/migrator/schema_generator_test.php
@@ -26,6 +26,8 @@ class schema_generator_test extends phpbb_test_case
public function setUp(): void
{
+ global $phpbb_root_path, $phpEx;
+
parent::setUp();
$this->config = new \phpbb\config\config(array());
@@ -33,6 +35,8 @@ class schema_generator_test extends phpbb_test_case
$factory = new \phpbb\db\tools\factory();
$this->db_tools = $factory->get($this->db);
$this->table_prefix = 'phpbb_';
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $phpEx;
}
protected function get_schema_generator(array $class_names)
diff --git a/tests/passwords/drivers_test.php b/tests/passwords/drivers_test.php
index 8300431dfe..fc11ca0bc7 100644
--- a/tests/passwords/drivers_test.php
+++ b/tests/passwords/drivers_test.php
@@ -21,10 +21,15 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
$this->driver_helper = new \phpbb\passwords\driver\helper($config);
$phpbb_root_path = dirname(__FILE__) . '/../../phpBB/';
$php_ext = 'php';
+
+ // Initialize argon2 default options
+ $this->argon2_default_cost_options = [
+ 'memory_cost' => 1024,
+ 'time_cost' => 2,
+ 'threads' => 2
+ ];
$this->passwords_drivers = array(
- 'passwords.driver.argon2i' => new \phpbb\passwords\driver\argon2i($config, $this->driver_helper),
- 'passwords.driver.argon2id' => new \phpbb\passwords\driver\argon2id($config, $this->driver_helper),
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $this->driver_helper, 10),
'passwords.driver.bcrypt' => new \phpbb\passwords\driver\bcrypt($config, $this->driver_helper, 10),
'passwords.driver.salted_md5' => new \phpbb\passwords\driver\salted_md5($config, $this->driver_helper),
@@ -39,13 +44,26 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
);
$this->passwords_drivers['passwords.driver.md5_phpbb2'] = new \phpbb\passwords\driver\md5_phpbb2($request, $this->passwords_drivers['passwords.driver.salted_md5'], $this->driver_helper, $phpbb_root_path, $php_ext);
$this->passwords_drivers['passwords.driver.bcrypt_wcf2'] = new \phpbb\passwords\driver\bcrypt_wcf2($this->passwords_drivers['passwords.driver.bcrypt'], $this->driver_helper);
+
+ $pwhash_supported = function_exists('password_hash') && function_exists('password_needs_rehash') && function_exists('password_verify');
+ if (defined('PASSWORD_ARGON2I') && $pwhash_supported)
+ {
+ $this->passwords_drivers['passwords.driver.argon2i'] = new \phpbb\passwords\driver\argon2i($config, $this->driver_helper);
+ $this->argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2i']->get_options();
+ }
+
+ if (defined('PASSWORD_ARGON2ID') && $pwhash_supported)
+ {
+ $this->passwords_drivers['passwords.driver.argon2id'] = new \phpbb\passwords\driver\argon2id($config, $this->driver_helper);
+ $this->argon2_default_cost_options = $this->passwords_drivers['passwords.driver.argon2id']->get_options();
+ }
}
public function data_helper_encode64()
{
return array(
- array('foobar', 6, 'axqPW3aQ'),
- array('foobar', 7, 'axqPW3aQ..'),
+ array('foobars', 6, 'axqPW3aQ'),
+ array('foobarss', 7, 'axqPW3aQn/'),
array('foobar', 5, 'axqPW34'),
);
}
@@ -418,20 +436,34 @@ class phpbb_passwords_helper_test extends \phpbb_test_case
public function data_needs_rehash()
{
- return array(
+ $data_array = [
array('passwords.driver.bcrypt_2y', '$2y$10$somerandomhash', false),
array('passwords.driver.bcrypt', '$2a$10$somerandomhash', false),
array('passwords.driver.salted_md5', 'foobar', false),
array('passwords.driver.bcrypt_2y', '$2y$9$somerandomhash', true),
array('passwords.driver.bcrypt', '$2a$04$somerandomhash', true),
- array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=2$NEF0S1JSN04yNGQ1UVRKdA$KYGNI9CbjoKh1UEu1PpdlqbuLbveGwkMcwcT2Un9pPM', false),
- array('passwords.driver.argon2i', '$argon2i$v=19$m=128,t=2,p=2$M29GUi51QjdKLjIzbC9scQ$6h1gZDqn7JTmVdQ0lJh1x5nyvgO/DaJWUKOFJ0itCJ0', true),
- array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=1,p=2$UnFHb2F4NER3M0xWWmxMUQ$u3javvoAZJeIyR1P3eg0tb8VjEeXvQPagqwetonq1NA', true),
- array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=1$bm5SeGJ3R3ZRY1A0YXJPNg$v1A9m4sJW+ge0RBtpJ4w9861+J9xkguKBAsZHrG8LQU', true),
- array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=2,p=2$MXB4OW5sczE5TnFPYkEuYQ$2bxaMIp8+9x37O6v8zkqpBU72ohCibUrtgVZw7vyr5Q', false),
- array('passwords.driver.argon2id', '$argon2id$v=19$m=128,t=2,p=2$RWV2VFAuWXk5bTVjbktOLg$Nt7Z7koa25SVRSKr3RKqjwKz26FENDuU+aL1DfMcWRo', true),
- array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=1,p=2$Rmw5M21IUFZDVEltYU0uTA$GIObGbHV6sOw5OQEtF8z+2ESztT96OWhCk17sUlwLAY', true),
- );
+ ];
+
+ if (isset($this->passwords_drivers['passwords.driver.argon2i']))
+ {
+ $data_array = array_merge($data_array, [
+ array('passwords.driver.argon2i', '$argon2i$v=19$m=' . $this->argon2_default_cost_options['memory_cost'] . ',t=' . $this->argon2_default_cost_options['time_cost'] . ',p=' . $this->argon2_default_cost_options['threads'] . '$NEF0S1JSN04yNGQ1UVRKdA$KYGNI9CbjoKh1UEu1PpdlqbuLbveGwkMcwcT2Un9pPM', false),
+ array('passwords.driver.argon2i', '$argon2i$v=19$m=128,t=2,p=2$M29GUi51QjdKLjIzbC9scQ$6h1gZDqn7JTmVdQ0lJh1x5nyvgO/DaJWUKOFJ0itCJ0', true),
+ array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=1,p=2$UnFHb2F4NER3M0xWWmxMUQ$u3javvoAZJeIyR1P3eg0tb8VjEeXvQPagqwetonq1NA', true),
+ array('passwords.driver.argon2i', '$argon2i$v=19$m=1024,t=2,p=1$bm5SeGJ3R3ZRY1A0YXJPNg$v1A9m4sJW+ge0RBtpJ4w9861+J9xkguKBAsZHrG8LQU', true),
+ ]);
+ }
+
+ if (isset($this->passwords_drivers['passwords.driver.argon2id']))
+ {
+ $data_array = array_merge($data_array, [
+ array('passwords.driver.argon2id', '$argon2id$v=19$m=' . $this->argon2_default_cost_options['memory_cost'] . ',t=' . $this->argon2_default_cost_options['time_cost'] . ',p=' . $this->argon2_default_cost_options['threads'] . '$MXB4OW5sczE5TnFPYkEuYQ$2bxaMIp8+9x37O6v8zkqpBU72ohCibUrtgVZw7vyr5Q', false),
+ array('passwords.driver.argon2id', '$argon2id$v=19$m=128,t=2,p=2$RWV2VFAuWXk5bTVjbktOLg$Nt7Z7koa25SVRSKr3RKqjwKz26FENDuU+aL1DfMcWRo', true),
+ array('passwords.driver.argon2id', '$argon2id$v=19$m=1024,t=1,p=2$Rmw5M21IUFZDVEltYU0uTA$GIObGbHV6sOw5OQEtF8z+2ESztT96OWhCk17sUlwLAY', true),
+ ]);
+ }
+
+ return $data_array;
}
/**