This commit is contained in:
2021-10-29 18:50:53 +08:00
parent 340c67b4ac
commit c87a9b4732
+5 -4
View File
@@ -4,7 +4,6 @@ defined('APP_PATH') or define('APP_PATH', realpath(__DIR__ . '/../../'));
use Annotation\Annotation; use Annotation\Annotation;
use Kiri\Context;
use Http\Handler\Router; use Http\Handler\Router;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Kiri\Abstracts\Config; use Kiri\Abstracts\Config;
@@ -20,7 +19,6 @@ use Kiri\Kiri;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Server\ServerManager; use Server\ServerManager;
use Swoole\WebSocket\Server; use Swoole\WebSocket\Server;
use Http\Message\Response as Par7Response;
if (!function_exists('make')) { if (!function_exists('make')) {
@@ -242,6 +240,9 @@ if (!function_exists('isUrl')) {
*/ */
function isUrl($url, $get_info = true): bool|array function isUrl($url, $get_info = true): bool|array
{ {
if (str_starts_with($url, '/')) {
return false;
}
$queryMatch = '/((http[s]?):\/\/)?(([\w\-\_]+\.)+\w+(:\d+)?)(\/.*)?/'; $queryMatch = '/((http[s]?):\/\/)?(([\w\-\_]+\.)+\w+(:\d+)?)(\/.*)?/';
if (!preg_match($queryMatch, $url, $outPut)) { if (!preg_match($queryMatch, $url, $outPut)) {
return false; return false;
@@ -988,8 +989,8 @@ if (!function_exists('jTraceEx')) {
function jTraceEx($e, $seen = null, bool $toHtml = false): string function jTraceEx($e, $seen = null, bool $toHtml = false): string
{ {
$starter = $seen ? 'Caused by: ' : ''; $starter = $seen ? 'Caused by: ' : '';
$result = array(); $result = [];
if (!$seen) $seen = array(); if (!$seen) $seen = [];
$trace = $e->getTrace(); $trace = $e->getTrace();
$prev = $e->getPrevious(); $prev = $e->getPrevious();
$result[] = sprintf('%s%s: %s', $starter, $e::class, $e->getMessage()); $result[] = sprintf('%s%s: %s', $starter, $e::class, $e->getMessage());