Unify compile error details under reinfo

This commit is contained in:
jieer
2026-07-23 10:56:33 +08:00
parent 8420e0529f
commit 44812f70e3
4 changed files with 21 additions and 17 deletions
+16 -11
View File
@@ -181,9 +181,10 @@ function parse_diff_blocks($text) {
return $blocks;
}
$is_compile_error = intval($row['result']) == 11;
$view_reinfo = "";
$view_reinfo_raw = ""; // 原始(管理员/有权限者看)
$view_reinfo_summary = ""; // 折叠后(普通用户看)
$view_reinfo_raw = ""; // 原始(管理员/有权限者看)
$view_reinfo_summary = ""; // 折叠后(普通用户看)
$view_reinfo_dedup_count = 0; // 折叠掉的测试点数
$verdict_color_class = "blue"; // semantic ui color: green/red/orange/yellow/grey
$result_icon = "info circle";
@@ -195,8 +196,10 @@ if($ok){
$view_mail_link= "<a href='mail.php?to_user=".htmlentities($row['user_id'],ENT_QUOTES,"UTF-8")."&title=$MSG_SUBMIT $id'>Mail the auther</a>";
}
$sql = "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`=?";
$rt = pdo_query($sql,$id);
$sql = $is_compile_error
? "SELECT `error` FROM `compileinfo` WHERE `solution_id`=?"
: "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`=?";
$rt = pdo_query($sql,$id);
$raw_error = "";
if(isset($rt[0])){
$raw_error = $rt[0]['error'];
@@ -246,8 +249,8 @@ if($ok){
case 10: // RE
$verdict_tip = "程序运行中发生错误(Runtime Error";
break;
case 11: // CE
$verdict_tip = "编译错误(Compile Error)。请查看编译信息";
case 11: // CE
$verdict_tip = "编译错误(Compile Error)。请查看下方编译信息。";
break;
case 13: // TR (test run)
$verdict_tip = "测试运行完成(Test Run";
@@ -258,10 +261,12 @@ if($ok){
// === 阶段 3:原始错误处理(syscall 提示 vs 占位符修复)===
$view_reinfo_raw = $raw_error;
if (trim($raw_error) === "") {
// TLE/MLE/OLE 时 runtimeinfo 通常为空
$view_reinfo_summary = "";
} else {
if (trim($raw_error) === "") {
// TLE/MLE/OLE 时 runtimeinfo 通常为空
$view_reinfo_summary = "";
} elseif ($is_compile_error) {
$view_reinfo_summary = $raw_error;
} else {
// 含 "PASS" 不再显示 "error3" 占位
// 含 "php" 不再显示 "error2" 占位(用 generic 提示)
if (strpos($raw_error, "php") !== false) {
@@ -348,7 +353,7 @@ else{
/////////////////////////Template
if(!isset($_SESSION[$OJ_NAME.'_'.'source_browser']) && $OJ_SHOW_DIFF==false){
if(!$is_compile_error && !isset($_SESSION[$OJ_NAME.'_'.'source_browser']) && $OJ_SHOW_DIFF==false){
$view_errors = $MSG_WARNING_ACCESS_DENIED;
require("template/".$OJ_TEMPLATE."/error.php");
exit(0);