diff --git a/score/Core/App.php b/score/Core/App.php index 7c61575f..b335e85a 100755 --- a/score/Core/App.php +++ b/score/Core/App.php @@ -40,7 +40,7 @@ class App extends \Swoolefy\Core\Component { /** * $coroutine_id - * @var [type] + * @var null */ public $coroutine_id; diff --git a/score/Core/AppTrait.php b/score/Core/AppTrait.php index 0643d57e..b71e161b 100755 --- a/score/Core/AppTrait.php +++ b/score/Core/AppTrait.php @@ -572,17 +572,14 @@ public function redirect(string $url, array $params = [], int $code = 301) { $query_string = rtrim($query_string,'&'); } } - // 发送Http跳转,调用此方法会自动end发送并结束响应,2.2.0+版本支持 - if(version_compare(swoole_version(), '2.2.0', '>')) { + // 发送Http跳转,调用此方法会自动end发送并结束响应,4.2.0+版本支持 + if(version_compare(swoole_version(), '4.2.0', '>')) { $this->response->redirect($url.$query_string, $code); - return; }else { $this->status($code); $this->response->header('Location', $url.$query_string); $this->response->end(); - return; } - } /** @@ -624,7 +621,7 @@ public function dump($var, $echo=true, $label=null, $strict=true) { * asyncHttpClient 简单的模拟http异步并发请求 * @param array $urls * @param int $timeout 单位ms - * @return + * @return boolean */ public function asyncHttpClient(array $urls = [], int $timeout = 500) { if(!empty($urls)) { @@ -936,7 +933,7 @@ public function getClientOS() { } /** - * sendHttpStatus,参考tp的 + * sendHttpStatus * @param int $code * @return void */ diff --git a/score/Core/BaseServer.php b/score/Core/BaseServer.php index db1ab7bf..4b0e983b 100755 --- a/score/Core/BaseServer.php +++ b/score/Core/BaseServer.php @@ -660,7 +660,6 @@ public static function isEnablePvCollector() { $isEnablePvCollector = false; } return $isEnablePvCollector; - } /** diff --git a/score/Core/ComponentTrait.php b/score/Core/ComponentTrait.php index 9dae1c83..8e4a9a68 100644 --- a/score/Core/ComponentTrait.php +++ b/score/Core/ComponentTrait.php @@ -32,7 +32,7 @@ trait ComponentTrait { * @param string $com_alias_name 组件别名 * @param array $defination 组件定义类 * @throws - * @return array + * @return mixed */ public function creatObject(string $com_alias_name = null, array $defination = []) { @@ -64,6 +64,7 @@ public function creatObject(string $com_alias_name = null, array $defination = [ // 配置文件初始化创建公用对象 $coreComponents = $this->coreComponents(); $components = array_merge($coreComponents, Swfy::getAppConf()['components']); + foreach($components as $com_name=>$component) { if($this->isSetOpenPoolsOfComponent($component)) { @@ -71,9 +72,11 @@ public function creatObject(string $com_alias_name = null, array $defination = [ continue; } - // 存在直接跳过 - if(isset($this->container[$com_name]) || (isset($component[SWOOLEFY_COM_IS_DELAY]) && $component[SWOOLEFY_COM_IS_DELAY])) { - continue; + if(isset($this->container[$com_name]) || isset($component[SWOOLEFY_COM_IS_DELAY])) { + $is_delay = filter_var($component[SWOOLEFY_COM_IS_DELAY], FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); + if($is_delay === true) { + continue; + } } if(isset($component['class']) && $component['class'] != '') { diff --git a/score/Core/HttpRoute.php b/score/Core/HttpRoute.php index e5141425..c9361640 100755 --- a/score/Core/HttpRoute.php +++ b/score/Core/HttpRoute.php @@ -243,6 +243,7 @@ public function invoke($module = null, $controller = null, $action = null) { // 方法调用发生异常后 引导到__call方法处理 $method = new \ReflectionMethod($controllerInstance, '__call'); $method->invokeArgs($controllerInstance, array($action, '')); + }catch(\Throwable $t) { $query_string = isset($this->request->server['QUERY_STRING']) ? '?'.$this->request->server['QUERY_STRING'] : ''; $msg = 'Fatal error: '.$t->getMessage().' on '.$t->getFile().' on line '.$t->getLine(). ' ||| '.$this->request->server['REQUEST_URI'].$query_string; diff --git a/score/Core/View.php b/score/Core/View.php index 9284ef84..1bdd0264 100755 --- a/score/Core/View.php +++ b/score/Core/View.php @@ -201,9 +201,6 @@ public function returnJson($data, $formater = 'json') { $string = $data; default:$string = json_encode($data,0);break; } - if($this->enable_gzip) { - $response->gzip($this->gzip_level); - } $response->write($string); }