diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 0edcf91bc1..238a9b3eb7 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -708,7 +708,8 @@ class baseHelper public static function header301($locate): never { header('HTTP/1.1 301 Moved Permanently'); - die(header('Location:' . $locate)); + header('Location:' . $locate); + throw EndResponseException::create(); } /** @@ -786,7 +787,7 @@ class baseHelper if(isset($config->framework->autoRepairTable) and $config->framework->autoRepairTable) { header("location: " . $config->webRoot . 'checktable.php'); - exit; + throw EndResponseException::create(); } return $lang->repairTable; } diff --git a/framework/control.class.php b/framework/control.class.php index 6a81aeeb0a..4f8cd727e0 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -311,7 +311,7 @@ class control extends baseControl } if(!is_file($viewFile)) $viewFile = dirname((string) $viewExtPath['common'], 2) . DS . 'view' . DS . $this->devicePrefix . $methodName . ".{$viewType}.php"; - if(!is_file($viewFile)) die(js::error($this->lang->notPage) . js::locate('back')); + if(!is_file($viewFile)) helper::end(js::error($this->lang->notPage) . js::locate('back')); /* Get ext hook files. */ $commonExtHookFiles = glob($viewExtPath['common'] . $this->devicePrefix . $methodName . ".*.{$viewType}.hook.php"); diff --git a/framework/router.class.php b/framework/router.class.php index a47f850996..7bfac45ef9 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -487,7 +487,7 @@ class router extends baseRouter /* Check if the requested module is defined in workflow. */ $flow = $this->dbh->query("SELECT * FROM " . TABLE_WORKFLOW . " WHERE `module` = '$this->moduleName'")->fetch(); if(!$flow) return parent::setControlFile($exitIfNone); - if($flow->status != 'normal') die("
{$this->lang->flowNotRelease}"); + if($flow->status != 'normal') helper::end("{$this->lang->flowNotRelease}"); /** * 工作流中配置的标签应该请求browse方法,而某些内置流程本身包含browse方法。在这里处理请求的时候会无法区分是内置的browse方法还是工作 diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index fea658309b..f4c04af9dd 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -2204,12 +2204,12 @@ class baseSQL if(!empty($limit)) { $trimedLimit = trim(str_replace('limit', '', $limit)); - if(!preg_match('/^[0-9]+ *(, *[0-9]+)?$/', $trimedLimit)) die("Limit is bad query, The limit is " . htmlspecialchars($limit)); + if(!preg_match('/^[0-9]+ *(, *[0-9]+)?$/', $trimedLimit)) helper::end("Limit is bad query, The limit is " . htmlspecialchars($limit)); } $orders = trim($orders); if(empty($orders)) return $this; - if(!preg_match('/^(\w+\.)?(`\w+`|\w+)( +(desc|asc))?( *(, *(\w+\.)?(`\w+`|\w+)( +(desc|asc))?)?)*$/i', $orders)) die("Order is bad request, The order is " . htmlspecialchars($orders)); + if(!preg_match('/^(\w+\.)?(`\w+`|\w+)( +(desc|asc))?( *(, *(\w+\.)?(`\w+`|\w+)( +(desc|asc))?)?)*$/i', $orders)) helper::end("Order is bad request, The order is " . htmlspecialchars($orders)); $orders = explode(',', $orders); foreach($orders as $i => $order) @@ -2255,7 +2255,7 @@ class baseSQL if(!preg_match('/^[0-9]+ *(, *[0-9]+)?$/', $limit)) { $limit = htmlspecialchars($limit); - die("Limit is bad query, The limit is $limit"); + helper::end("Limit is bad query, The limit is $limit"); } $this->sql .= ' ' . DAO::LIMIT . " $limit "; return $this; @@ -2275,7 +2275,7 @@ class baseSQL if(!preg_match('/^\w+[a-zA-Z0-9_`.]+$/', $groupBy)) { $groupBy = htmlspecialchars($groupBy); - die("Group is bad query, The group is $groupBy"); + helper::end("Group is bad query, The group is $groupBy"); } $this->sql .= ' ' . DAO::GROUPBY . " $groupBy"; return $this; diff --git a/lib/base/filter/filter.class.php b/lib/base/filter/filter.class.php index cba6d91137..3ca9274c07 100644 --- a/lib/base/filter/filter.class.php +++ b/lib/base/filter/filter.class.php @@ -879,7 +879,7 @@ class baseFixer break; default: - die('scope not supported, should be post|get|server|session|cookie|env'); + helper::end('scope not supported, should be post|get|server|session|cookie|env'); } }