* Reduce the PHP Fatal error: Uncaught EndResponseException.

This commit is contained in:
dingguodong
2023-06-10 18:22:35 +08:00
parent 3550984905
commit f22b41da55
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -2525,13 +2525,13 @@ EOF;
* 忽略如下情况:非 HTML 请求、Ajax 请求、特殊 GET 参数 _single。
* Ignore the following situations: non-HTML request, Ajax request, special GET parameter _single.
*/
if($this->app->getViewType() != 'html' || helper::isAjaxRequest() || isset($_GET['_single'])) return;
if($this->app->getViewType() != 'html' || helper::isAjaxRequest() || isset($_GET['_single'])) return true;
/**
* 忽略无请求头 HTTP_SEC_FETCH_DEST 或者 HTTP_SEC_FETCH_DEST 为 iframe 的请求,较新的浏览器在启用 https 的情况下才会正确发送该请求头。
* Ignore the request without HTTP_SEC_FETCH_DEST or HTTP_SEC_FETCH_DEST is iframe, the latest browser will send this request header correctly when enable https.
*/
if(!isset($_SERVER['HTTP_SEC_FETCH_DEST']) || $_SERVER['HTTP_SEC_FETCH_DEST'] == 'iframe') return;
if(!isset($_SERVER['HTTP_SEC_FETCH_DEST']) || $_SERVER['HTTP_SEC_FETCH_DEST'] == 'iframe') return true;
/**
* 当有 HTTP_REFERER 请求头时,忽略 safari 浏览器,因为 safari 浏览器不会正确发送 HTTP_SEC_FETCH_DEST 请求头。
@@ -2540,7 +2540,7 @@ EOF;
if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']))
{
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
if(strpos($userAgent, 'chrome') === false && strpos($userAgent, 'safari') !== false) return;
if(strpos($userAgent, 'chrome') === false && strpos($userAgent, 'safari') !== false) return true;
}
/**
@@ -2550,7 +2550,7 @@ EOF;
$module = $this->app->getModuleName();
$method = $this->app->getMethodName();
$whitelist = '|index|tutorial|install|upgrade|sso|cron|misc|user-login|user-deny|user-logout|user-reset|user-forgetpassword|user-resetpassword|my-changepassword|my-preference|file-read|file-download|file-uploadimages|file-ajaxwopifiles|report-annualdata|misc-captcha|execution-printkanban|traincourse-ajaxuploadlargefile|traincourse-playvideo|';
if(strpos($whitelist, "|{$module}|") !== false || strpos($whitelist, "|{$module}-{$method}|") !== false) return;
if(strpos($whitelist, "|{$module}|") !== false || strpos($whitelist, "|{$module}-{$method}|") !== false) return true;
/**
* 如果以上条件都不满足,则视为当前页面必须在 iframe 中打开,使用 302 跳转实现。
@@ -2560,7 +2560,7 @@ EOF;
$redirectUrl = helper::createLink('index', 'index');
$redirectUrl .= strpos($redirectUrl, '?') === false ? "?open=$url" : "&open=$url";
header("location: $redirectUrl");
helper::end();
return false;
}
/**