修复(today_bonds,admin.php): PHP数组key自动转整数导致r.name为number→escAdmHtml爆炸\n\n【根因】PHP中[['player_name']]当玩家名为纯数字时,PHP自动将\narray key转为integer,array_keys返回整数。JSON编码后name字段为number。\nJS端(r.name||'') → 123||'' = 123,123.replace() → TypeError。\n\n【修复】\n- today_bonds.php: 'name' => (string) 显式字符串化\n- admin.php: escAdmHtml 改用 String(s??'') 防御所有非字符串类型
This commit is contained in:
+1
-1
@@ -82,7 +82,7 @@ function getTodayBondData() {
|
||||
$income = $incomeData[$p] ?? 0;
|
||||
$net = $income - $spend;
|
||||
$totalSpend += $spend; $totalIncome += $income;
|
||||
$rows[] = ['name' => $p, 'spend' => $spend, 'income' => $income, 'net' => $net];
|
||||
$rows[] = ['name' => (string)$p, 'spend' => $spend, 'income' => $income, 'net' => $net];
|
||||
}
|
||||
usort($rows, fn($a,$b) => $b['net'] - $a['net']);
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user