get(BugRepository::class); $bug = $bugRepository->findOneById($bug_id); if (!is_array($bug)) { response_header('No Such Bug'); display_bug_error("No such bug #{$bug_id}"); response_footer(); exit; } // If bug exists, continue.. $RESOLVE_REASONS = $FIX_VARIATIONS = $errors = []; if ($logged_in != 'developer') { $errors[] = 'The username or password you supplied was incorrect.'; } $project = !empty($_GET['project']) ? $_GET['project'] : false; $reasonRepository = $container->get(ReasonRepository::class); list($RESOLVE_REASONS, $FIX_VARIATIONS) = $reasonRepository->findByProject($site); // Handle reason / comments $reason = isset($_REQUEST['r']) ? filter_var($_REQUEST['r'], FILTER_SANITIZE_STRING) : ''; $ncomment = isset($_POST['ncomment']) ? trim($_POST['ncomment']) : ''; if (!$reason || !isset($RESOLVE_REASONS[$reason])) { $errors[] = 'You have to use a valid reason to resolve this bug.'; } if (isset($RESOLVE_REASONS[$reason]) && $RESOLVE_REASONS[$reason]['status'] == 'Not a bug' && $ncomment == '') { $errors[] = 'You must provide a comment when marking a bug \'Not a bug\''; } // Handle errors if ($errors) { response_header('Error in resolving bug'); display_bug_error($errors); ?>
$status, 'bug_type' => $bug['bug_type'], 'php_version' => $bug['php_version'], 'php_os' => $bug['php_os'], 'assign' => $bug['assign'], ]; // Assign automatically when closed if ($status == 'Closed' && $in['assign'] == '') { $in['assign'] = $auth_user->handle; } try { // Update bug $dbh->prepare(" UPDATE bugdb SET status = ?, assign = ?, ts2 = NOW() WHERE id = ? ")->execute([ $status, $in['assign'], $bug_id, ]); // Add changelog entry $changed = bug_diff($bug, $in); if (!empty($changed)) { $log_comment = bug_diff_render_html($changed); if (!empty($log_comment)) { $result = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $log_comment, 'log'); } } // Add possible comment if (!empty($ncomment)) { $result = bugs_add_comment($bug_id, $auth_user->email, $auth_user->name, $ncomment, 'comment'); } // Send emails mail_bug_updates($bug, $in, $auth_user->email, $ncomment); redirect("bug.php?id={$bug_id}&thanks=1"); } catch (\Exception $e) { // If we end up here, something went wrong. response_header('Resolve Bug: Problem'); display_bug_error($e->getMessage()); response_footer(); }