diff --git a/phpBB/posting.php b/phpBB/posting.php index 8105d9a282..6fc56abdd9 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -73,6 +73,7 @@ switch ($mode) $forum_id = (int) $db->sql_fetchfield('forum_id'); $db->sql_freeresult($result); } + if (!$topic_id || !$forum_id) { trigger_error('NO_TOPIC'); @@ -1841,23 +1842,23 @@ $s_action = append_sid("{$phpbb_root_path}posting.$phpEx", "mode=$mode"); switch ($mode) { case 'post': - $s_action .= ($forum_id) ? "&f=$forum_id" : ''; + $s_action .= $forum_id ? "&f=$forum_id" : ''; $page_title = $user->lang['POST_TOPIC']; break; case 'reply': - $s_action .= ($topic_id) ? "&t=$topic_id" : ''; + $s_action .= $topic_id ? "&t=$topic_id" : ''; $page_title = $user->lang['POST_REPLY']; break; case 'quote': - $s_action .= ($post_id) ? "&p=$post_id" : ''; + $s_action .= $post_id ? "&p=$post_id" : ''; $page_title = $user->lang['POST_REPLY']; break; case 'delete': case 'edit': - $s_action .= ($post_id) ? "&p=$post_id" : ''; + $s_action .= $post_id ? "&p=$post_id" : ''; $page_title = $user->lang['EDIT_POST']; break; } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 2647dfa14b..fff8ab8ce7 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -1146,7 +1146,7 @@ class phpbb_functional_test_case extends phpbb_test_case 'subject' => $subject, 'message' => $message, 'post' => true, - 'topic_id' => $topic_id, + 'topic_id' => $topic_id, ), $additional_form_data); return self::submit_post($posting_url, 'POST_REPLY', $form_data, $expected); @@ -1182,8 +1182,8 @@ class phpbb_functional_test_case extends phpbb_test_case $url = $crawler->selectLink($form_data['subject'])->link()->getUri(); - $topic_id = $this->get_parameter_from_link($url, 't'); - if (!$topic_id) + $topic_id = $this->get_parameter_from_link($url, 't'); + if (!$topic_id) { $topic_id = $form_data['topic_id']; }