From 9fe3a0be2903f67eaec59ff57c12a1264733ac35 Mon Sep 17 00:00:00 2001 From: whwyy Date: Wed, 13 Dec 2023 21:01:59 +0800 Subject: [PATCH] eee --- kiri-engine/Core/Str.php | 6 +++--- kiri-engine/Error/ErrorHandler.php | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/kiri-engine/Core/Str.php b/kiri-engine/Core/Str.php index 48c43d79..435c125a 100644 --- a/kiri-engine/Core/Str.php +++ b/kiri-engine/Core/Str.php @@ -151,7 +151,7 @@ class Str { $res = []; $add = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; - $len = strlen($key) < 0 ? 1 : (strlen($key) + 5 > strlen($add) ? strlen($add) - 5 : strlen($key)); + $len = strlen($key) + 5 > strlen($add) ? strlen($add) - 5 : strlen($key); if ($number < 1) $number = 10; $array = str_split($str); asort($array); @@ -227,8 +227,8 @@ class Str */ public static function clear(string $string): array|string|null { - $char = '。、!?:;﹑•"…‘’“”〝〞∕¦‖— 〈〉﹞﹝「」‹›〖〗】【»«』『〕〔》《﹐¸﹕︰﹔!¡?¿﹖﹌﹏﹋'´ˊˋ―﹫︳︴¯_ ̄﹢﹦﹤‐­˜﹟﹩﹠﹪﹡﹨﹍﹉﹎﹊ˇ︵︶︷︸︹︿﹀︺︽︾ˉ﹁﹂﹃﹄︻︼()'; - return preg_replace(["/[[:punct:]]/i", '/[' . $char . ']/u', '/[ ]{2,}/'], '', $string); + $char = '。、!?:;﹑•"…‘’“”〝〞∕¦‖— 〈〉﹞﹝「」‹›〖〗】【»«』『〕〔》《﹐¸﹕︰﹔¡¿﹖﹌﹏﹋'´ˊˋ―﹫︳︴¯_ ̄﹢﹦﹤‐­˜﹟﹩﹠﹪﹡﹨﹍﹉﹎﹊ˇ︵︶︷︸︹︿﹀︺︽︾ˉ﹁﹂﹃﹄︻︼()'; + return preg_replace(["/[[:punct:]]/i", '/[' . $char . ']/u', '/ {2,}/'], '', $string); } diff --git a/kiri-engine/Error/ErrorHandler.php b/kiri-engine/Error/ErrorHandler.php index 80e19ee4..8835c12c 100644 --- a/kiri-engine/Error/ErrorHandler.php +++ b/kiri-engine/Error/ErrorHandler.php @@ -91,7 +91,7 @@ class ErrorHandler extends Component implements ErrorInterface /** * @return void - * @throws ReflectionException + * @throws * @throws */ public function shutdown(): void @@ -100,7 +100,9 @@ class ErrorHandler extends Component implements ErrorInterface if (empty($lastError) || $lastError['type'] !== E_ERROR) { return; } - trigger_print_error($lastError['message']); + + $this->getLogger()->failure($lastError['message'] . PHP_EOL); + event(new OnSystemError()); } @@ -114,7 +116,7 @@ class ErrorHandler extends Component implements ErrorInterface { $this->category = 'exception'; - trigger_print_error($exception); + $this->getLogger()->failure($exception); event(new OnSystemError()); }