shi-yang / jnoj

Jiangnan Online Judge
https://www.jnoj.dev
Other
241 stars 62 forks source link

修复非法查看打印详情页时报内部错误的问题 #111

Closed bobby285271 closed 2 years ago

bobby285271 commented 3 years ago

问题

非法查看打印详情页时报内部错误,报错:

PHP Notice – yii\base\ErrorException
Trying to get property 'user_id' of non-object

复现

期望:显示 404。 实际:内部错误。

说明

https://github.com/shi-yang/jnoj/blob/8fe96b68ce955fee97db02554f5cb3a74ae8574a/controllers/PrintController.php#L156-L174 考虑 $model === null 的情况,访问 $model->user_id 自然会报错(第 166-167 行)。