1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-10 18:54:08 +02:00

[ticket/17077] Add proper locking in PHP without releasing form tokens

PHPBB3-17077
This commit is contained in:
Marc Alexander
2024-05-01 11:22:29 +02:00
parent 98929ca983
commit 6f45b46746
5 changed files with 26 additions and 30 deletions

View File

@@ -96,6 +96,14 @@ class phpbb_functional_test_case extends phpbb_test_case
$db = $this->get_db();
// Special flag for testing without possibility to run into lock scenario.
// Unset entry and add it back if lock behavior for posting should be tested.
// Unset ci_tests_no_lock_posting from config
$db->sql_return_on_error(true);
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value) VALUES ('ci_tests_no_lock_posting', '1')";
$this->db->sql_query($sql);
$db->sql_return_on_error(false);
foreach (static::setup_extensions() as $extension)
{
$this->purge_cache();
@@ -120,6 +128,11 @@ class phpbb_functional_test_case extends phpbb_test_case
if ($this->db instanceof \phpbb\db\driver\driver_interface)
{
// Unset ci_tests_no_lock_posting from config
$sql = 'DELETE FROM ' . CONFIG_TABLE . "
WHERE config_name = 'ci_tests_no_lock_posting'";
$this->db->sql_query($sql);
// Close the database connections again this test
$this->db->sql_close();
}
@@ -193,6 +206,9 @@ class phpbb_functional_test_case extends phpbb_test_case
$this->excludeBackupStaticAttributes($backupStaticAttributesBlacklist);
}
/**
* @return \phpbb\db\driver\driver_interface
*/
protected function get_db()
{
global $phpbb_root_path, $phpEx;