diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7f8228a5bd..4e725ba0fd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -83,7 +83,8 @@ jobs: - name: Check commit message if: github.event_name == 'pull_request' run: | - git-tools/commit-msg-hook-range.sh $(git rev-list --merges -n 1 HEAD^1)..$GITHUB_SHA + git fetch origin $GITHUB_BASE_REF &> /dev/null + git-tools/commit-msg-hook-range.sh $(git rev-parse origin/$GITHUB_BASE_REF)..$GITHUB_SHA # Tests for MySQL and MariaDB mysql-tests: @@ -242,6 +243,16 @@ jobs: db: "postgres:12" - php: '7.1' db: "postgres:13" + - php: '7.2' + db: "postgres:13" + - php: '7.3' + db: "postgres:13" + - php: '7.4' + db: "postgres:13" + - php: '8.0' + db: "postgres:12" + - php: '8.0' + db: "postgres:13" name: PHP ${{ matrix.php }} - ${{ matrix.db }} diff --git a/build/build.xml b/build/build.xml index 9a183e71dd..3df3b91946 100644 --- a/build/build.xml +++ b/build/build.xml @@ -4,7 +4,7 @@ - + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 11091ca5c5..af9e47d5e7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -50,6 +50,7 @@
  1. Changelog
      +
    • Changes since 3.3.4-RC1
    • Changes since 3.3.3
    • Changes since 3.3.2
    • Changes since 3.3.1
    • @@ -155,6 +156,16 @@
      +

      Changes since 3.3.4-RC1

      +

      Bug

      +
        +
      • [PHPBB3-16735] - Trying to access array offset on value of type bool
      • +
      • [PHPBB3-16739] - Wrong variable in report_pm.txt subject
      • +
      • [PHPBB3-16740] - Installation errors in php 8 when using postgresql
      • +
      • [PHPBB3-16743] - Properly check if TMP file exists - PHP 8
      • +
      • [PHPBB3-16747] - Typo in phpBB/language/en/email/post_in_queue.txt
      • +
      +

      Changes since 3.3.3

      Bug

        diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 59cbbb0d16..f382408a38 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -247,7 +247,10 @@ define('BANLIST_TABLE', $table_prefix . 'banlist'); define('BBCODES_TABLE', $table_prefix . 'bbcodes'); define('BOOKMARKS_TABLE', $table_prefix . 'bookmarks'); define('BOTS_TABLE', $table_prefix . 'bots'); -@define('CONFIG_TABLE', $table_prefix . 'config'); +if (!defined('CONFIG_TABLE')) +{ + define('CONFIG_TABLE', $table_prefix . 'config'); +} define('CONFIG_TEXT_TABLE', $table_prefix . 'config_text'); define('CONFIRM_TABLE', $table_prefix . 'confirm'); define('DISALLOW_TABLE', $table_prefix . 'disallow'); diff --git a/phpBB/install/app.php b/phpBB/install/app.php index 36d16e914b..bf2c81bfcc 100644 --- a/phpBB/install/app.php +++ b/phpBB/install/app.php @@ -16,10 +16,7 @@ */ define('IN_PHPBB', true); define('IN_INSTALL', true); -if (!defined('PHPBB_ENVIRONMENT')) -{ - define('PHPBB_ENVIRONMENT', 'production'); -} + $phpbb_root_path = '../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); diff --git a/phpBB/install/phpbbcli.php b/phpBB/install/phpbbcli.php index c9aef2b7b6..9a96dc45bf 100755 --- a/phpBB/install/phpbbcli.php +++ b/phpBB/install/phpbbcli.php @@ -23,7 +23,7 @@ if (php_sapi_name() !== 'cli') define('IN_PHPBB', true); define('IN_INSTALL', true); define('PHPBB_ENVIRONMENT', 'production'); -define('PHPBB_VERSION', '3.3.4-RC1'); +define('PHPBB_VERSION', '3.3.4'); $phpbb_root_path = __DIR__ . '/../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); diff --git a/phpBB/language/en/email/post_in_queue.txt b/phpBB/language/en/email/post_in_queue.txt index d3a8259a9a..8ccbc8e9bb 100644 --- a/phpBB/language/en/email/post_in_queue.txt +++ b/phpBB/language/en/email/post_in_queue.txt @@ -1,4 +1,4 @@ -Subject: Post needs aprroval - "{TOPIC_TITLE}" +Subject: Post needs approval - "{TOPIC_TITLE}" Hello {USERNAME}, diff --git a/phpBB/language/en/email/short/post_in_queue.txt b/phpBB/language/en/email/short/post_in_queue.txt index d3a8259a9a..8ccbc8e9bb 100644 --- a/phpBB/language/en/email/short/post_in_queue.txt +++ b/phpBB/language/en/email/short/post_in_queue.txt @@ -1,4 +1,4 @@ -Subject: Post needs aprroval - "{TOPIC_TITLE}" +Subject: Post needs approval - "{TOPIC_TITLE}" Hello {USERNAME}, diff --git a/phpBB/language/en/email/short/report_pm.txt b/phpBB/language/en/email/short/report_pm.txt index 7a5f17a7d9..771646046b 100644 --- a/phpBB/language/en/email/short/report_pm.txt +++ b/phpBB/language/en/email/short/report_pm.txt @@ -1,4 +1,4 @@ -Subject: Private Message report - "{TOPIC_TITLE}" +Subject: Private Message report - "{SUBJECT}" Hello {USERNAME}, diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php index a50e1343f6..4810a9587e 100644 --- a/phpBB/phpbb/auth/provider/db.php +++ b/phpBB/phpbb/auth/provider/db.php @@ -153,8 +153,12 @@ class db extends base } $login_error_attempts = 'LOGIN_ERROR_ATTEMPTS'; - $show_captcha = ($this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']) || - ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']); + + $user_login_attempts = (is_array($row) && $this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']); + $ip_login_attempts = ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']); + + $show_captcha = $user_login_attempts || $ip_login_attempts; + if ($show_captcha) { $captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php index 52a5b6b546..7541d1e6b6 100644 --- a/phpBB/phpbb/db/driver/postgres.php +++ b/phpBB/phpbb/db/driver/postgres.php @@ -277,9 +277,10 @@ class postgres extends \phpbb\db\driver\driver $query_id = $this->query_result; } - if ($cache && $cache->sql_exists($query_id)) + $safe_query_id = $this->clean_query_id($query_id); + if ($cache && $cache->sql_exists($safe_query_id)) { - return $cache->sql_fetchrow($query_id); + return $cache->sql_fetchrow($safe_query_id); } return ($query_id) ? pg_fetch_assoc($query_id, null) : false; @@ -297,14 +298,47 @@ class postgres extends \phpbb\db\driver\driver $query_id = $this->query_result; } - if ($cache && $cache->sql_exists($query_id)) + $safe_query_id = $this->clean_query_id($query_id); + if ($cache && $cache->sql_exists($safe_query_id)) { - return $cache->sql_rowseek($rownum, $query_id); + return $cache->sql_rowseek($rownum, $safe_query_id); } return ($query_id) ? @pg_result_seek($query_id, $rownum) : false; } + /** + * {@inheritDoc} + */ + function sql_fetchfield($field, $rownum = false, $query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($query_id) + { + if ($rownum !== false) + { + $this->sql_rowseek($rownum, $query_id); + } + + $safe_query_id = $this->clean_query_id($query_id); + if ($cache && !is_object($query_id) && $cache->sql_exists($safe_query_id)) + { + return $cache->sql_fetchfield($safe_query_id, $field); + } + + $row = $this->sql_fetchrow($query_id); + return (isset($row[$field])) ? $row[$field] : false; + } + + return false; + } + /** * {@inheritDoc} */ @@ -346,14 +380,15 @@ class postgres extends \phpbb\db\driver\driver $query_id = $this->query_result; } - if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + $safe_query_id = $this->clean_query_id($query_id); + if ($cache && !is_object($query_id) && $cache->sql_exists($safe_query_id)) { - return $cache->sql_freeresult($query_id); + return $cache->sql_freeresult($safe_query_id); } - if (isset($this->open_queries[(int) $query_id])) + if (isset($this->open_queries[$safe_query_id])) { - unset($this->open_queries[(int) $query_id]); + unset($this->open_queries[$safe_query_id]); return pg_free_result($query_id); } @@ -431,6 +466,11 @@ class postgres extends \phpbb\db\driver\driver */ function _sql_close() { + // Released resources are already closed, return true in this case + if (!is_resource($this->db_connect_id)) + { + return true; + } return @pg_close($this->db_connect_id); } @@ -505,4 +545,16 @@ class postgres extends \phpbb\db\driver\driver { return '"' . $msg . '"'; } + + /** + * Ensure query ID can be used by cache + * + * @param resource|int|string $query_id Mixed type query id + * + * @return int|string Query id in string or integer format + */ + private function clean_query_id($query_id) + { + return is_resource($query_id) ? (int) $query_id : $query_id; + } } diff --git a/phpBB/phpbb/db/migration/data/v33x/v334.php b/phpBB/phpbb/db/migration/data/v33x/v334.php new file mode 100644 index 0000000000..05a47b09a7 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v33x/v334.php @@ -0,0 +1,36 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v33x; + +class v334 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.3.4', '>='); + } + + static public function depends_on() + { + return [ + '\phpbb\db\migration\data\v33x\v334rc1', + ]; + } + + public function update_data() + { + return [ + ['config.update', ['version', '3.3.4']], + ]; + } +} diff --git a/phpBB/phpbb/db/tools/postgres.php b/phpBB/phpbb/db/tools/postgres.php index 0c02a05d56..a19469910e 100644 --- a/phpBB/phpbb/db/tools/postgres.php +++ b/phpBB/phpbb/db/tools/postgres.php @@ -96,6 +96,24 @@ class postgres extends tools return $tables; } + /** + * {@inheritDoc} + */ + function sql_table_exists($table_name) + { + $sql = "SELECT CAST(EXISTS( + SELECT FROM information_schema.tables + WHERE table_schema = 'public' + AND table_name = '" . $this->db->sql_escape($table_name) . "' + ) AS INTEGER)"; + $result = $this->db->sql_query_limit($sql, 1); + $row = $this->db->sql_fetchrow($result); + $table_exists = (booL) $row['exists']; + $this->db->sql_freeresult($result); + + return $table_exists; + } + /** * {@inheritDoc} */ diff --git a/phpBB/phpbb/files/filespec.php b/phpBB/phpbb/files/filespec.php index d6d753024b..59c7948d1f 100644 --- a/phpBB/phpbb/files/filespec.php +++ b/phpBB/phpbb/files/filespec.php @@ -476,7 +476,10 @@ class filespec } // Remove temporary filename - @unlink($this->filename); + if (file_exists($this->filename)) + { + @unlink($this->filename); + } if (count($this->error)) { diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index ebaf573753..c46bbe11c3 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -29,7 +29,7 @@ abstract class phpbb_database_test_case extends TestCase static protected $install_schema_file; - static protected $phpunit_version; + static protected $phpunit_version; public function __construct($name = NULL, array $data = [], $dataName = '') {