1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-01 20:19:13 +02:00

Merge pull request #6729 from rxu/ticket/17391

[ticket/17391] Fix PHP warning on creating group with the name already in use
This commit is contained in:
Marc Alexander 2024-10-03 13:43:04 +02:00 committed by GitHub
commit ae1d830e84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 24 additions and 2 deletions

View File

@ -396,7 +396,7 @@ class acp_groups
$allow_desc_urls = $request->variable('desc_parse_urls', false);
$allow_desc_smilies = $request->variable('desc_parse_smilies', false);
$submit_ary = array(
$submit_ary = [
'colour' => $request->variable('group_colour', ''),
'rank' => $request->variable('group_rank', 0),
'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0,
@ -406,7 +406,13 @@ class acp_groups
'max_recipients' => $request->variable('group_max_recipients', 0),
'founder_manage' => 0,
'skip_auth' => $request->variable('group_skip_auth', 0),
);
// Initialize avatar data
'avatar' => $avatar_data['avatar'] ?? '',
'avatar_type' => $avatar_data['avatar_type'] ?? '',
'avatar_height' => $avatar_data['avatar_height'] ?? 0,
'avatar_width' => $avatar_data['avatar_width'] ?? 0,
];
if ($user->data['user_type'] == USER_FOUNDER)
{

View File

@ -123,4 +123,20 @@ class phpbb_functional_acp_groups_test extends phpbb_functional_common_groups_te
$this->assertEquals((bool) $tick_teampage, (bool) ($this->form_data['group_teampage'] ?? false));
}
}
public function test_acp_groups_create_existing_name()
{
$this->group_manage_login();
$crawler = self::request('GET', 'adm/index.php?i=groups&mode=manage&sid=' . $this->sid);
$form = $crawler->selectButton($this->lang('SUBMIT'))->form([
'group_name' => 'Guests', // 'Guests' is the group name already in use for predefined Guests group
]);
$crawler = self::submit($form);
$form = $crawler->selectButton($this->lang('SUBMIT'))->form();
$crawler = self::submit($form); // Just submit the form with selected group name
$this->assertStringContainsString($this->lang('GROUP_NAME_TAKEN'), $crawler->text());
}
}