diff --git a/src/think/Event.php b/src/think/Event.php index c972e9b8ba..3c70aadf25 100644 --- a/src/think/Event.php +++ b/src/think/Event.php @@ -218,7 +218,7 @@ public function trigger($event, $params = null, bool $once = false) $listeners = $this->listener[$event] ?? []; if (strpos($event, '.')) { - [$prefix, $event] = explode($event, '.', 2); + [$prefix, $event] = explode('.', $event, 2); if (isset($this->listener[$prefix . '.*'])) { $listeners = array_merge($listeners, $this->listener[$prefix . '.*']); } diff --git a/src/think/Request.php b/src/think/Request.php index a21976df11..f6c8f27d35 100644 --- a/src/think/Request.php +++ b/src/think/Request.php @@ -408,7 +408,8 @@ public function subDomain(): string $rootDomain = $this->rootDomain(); if ($rootDomain) { - $this->subDomain = rtrim(stristr($this->host(), $rootDomain, true), '.'); + $sub = stristr($this->host(), $rootDomain, true); + $this->subDomain = $sub ? rtrim($sub, '.') : ''; } else { $this->subDomain = ''; } @@ -1307,12 +1308,12 @@ protected function filterData($data, $filter, $name, $default) /** * 强制类型转换 - * @access public + * @access protected * @param mixed $data * @param string $type * @return mixed */ - private function typeCast(&$data, string $type) + protected function typeCast(&$data, string $type) { switch (strtolower($type)) { // 数组 @@ -1344,7 +1345,7 @@ private function typeCast(&$data, string $type) /** * 获取数据 - * @access public + * @access protected * @param array $data 数据源 * @param string $name 字段名 * @param mixed $default 默认值 diff --git a/src/think/console/command/RunServer.php b/src/think/console/command/RunServer.php index 20a2466278..d507c1d8c0 100644 --- a/src/think/console/command/RunServer.php +++ b/src/think/console/command/RunServer.php @@ -63,7 +63,7 @@ public function execute(Input $input, Output $output) escapeshellarg($root . DIRECTORY_SEPARATOR . 'router.php') ); - $output->writeln(sprintf('ThinkPHP Development server is started On ', '0.0.0.0' == $host ? '127.0.0.1' : $host, $port)); + $output->writeln(sprintf('ThinkPHP Development server is started On ', $host, $port)); $output->writeln(sprintf('You can exit with `CTRL-C`')); $output->writeln(sprintf('Document root is: %s', $root)); passthru($command); diff --git a/src/think/facade/Route.php b/src/think/facade/Route.php index 46bd7469cc..5a5b955db4 100644 --- a/src/think/facade/Route.php +++ b/src/think/facade/Route.php @@ -62,7 +62,7 @@ * @method static RuleItem redirect(string $rule, string $route = '', int $status = 301) 注册重定向路由 * @method static \think\Route rest(string|array $name, array|bool $resource = []) rest方法定义和修改 * @method static array|null getRest(string $name = null) 获取rest方法定义的参数 - * @method static RuleItem miss(string|Closure $route, string $method = '*') 注册未匹配路由规则后的处理 + * @method static RuleItem miss(string|\Closure $route, string $method = '*') 注册未匹配路由规则后的处理 * @method static Response dispatch(\think\Request $request, Closure|bool $withRoute = true) 路由调度 * @method static Dispatch|false check() 检测URL路由 * @method static Dispatch url(string $url) 默认URL解析