From e6e8e4bdae255a91f31b8545934b6a3e78c6af2b Mon Sep 17 00:00:00 2001 From: Rostunov Sergey Date: Sun, 12 Dec 2021 19:40:05 +0300 Subject: [PATCH 1/3] Fix compatibility of php 8.1 Deprecate passing null to non-nullable arguments of internal functions --- src/RunTracy/Middlewares/TracyMiddleware.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RunTracy/Middlewares/TracyMiddleware.php b/src/RunTracy/Middlewares/TracyMiddleware.php index d508d49..775d798 100644 --- a/src/RunTracy/Middlewares/TracyMiddleware.php +++ b/src/RunTracy/Middlewares/TracyMiddleware.php @@ -58,7 +58,8 @@ public function __invoke(Request $request, Response $response, callable $next) { $res = $next($request, $response); - $cookies = json_decode($request->getCookieParam('tracyPanelsEnabled')); + $tracyPanelsEnabled = $request->getCookieParam('tracyPanelsEnabled'); + $cookies = $tracyPanelsEnabled ? json_decode($tracyPanelsEnabled) : []; if (!empty($cookies)) { $def = array_fill_keys(array_keys($this->defcfg), null); $cookies = array_fill_keys($cookies, 1); From ccbf9e8aa7acc27d7113c1518bfa22d600523be3 Mon Sep 17 00:00:00 2001 From: Rostunov Sergey Date: Sun, 12 Dec 2021 21:29:30 +0300 Subject: [PATCH 2/3] Fix compatibility of php 8.1 --- src/RunTracy/Helpers/Profiler/ProfilerService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/RunTracy/Helpers/Profiler/ProfilerService.php b/src/RunTracy/Helpers/Profiler/ProfilerService.php index 95899af..b4ec577 100644 --- a/src/RunTracy/Helpers/Profiler/ProfilerService.php +++ b/src/RunTracy/Helpers/Profiler/ProfilerService.php @@ -91,10 +91,10 @@ private function getMetaData() $profile->meta[Profiler::START_MEMORY_USAGE], $profile->meta[Profiler::FINISH_MEMORY_USAGE] ); - $this->metaData[self::META_TIME_LINE][$profile->meta[Profiler::START_TIME] * 1000] = [ + $this->metaData[self::META_TIME_LINE][(int)($profile->meta[Profiler::START_TIME] * 1000)] = [ self::META_TIME_LINE__MEMORY_USAGE => $profile->meta[Profiler::START_MEMORY_USAGE] ]; - $this->metaData[self::META_TIME_LINE][$profile->meta[Profiler::FINISH_TIME] * 1000] = [ + $this->metaData[self::META_TIME_LINE][(int)($profile->meta[Profiler::FINISH_TIME] * 1000)] = [ self::META_TIME_LINE__MEMORY_USAGE => $profile->meta[Profiler::FINISH_MEMORY_USAGE] ]; } From 56989fbe75c252ce8d818f2fc80ca7b38b1dbe48 Mon Sep 17 00:00:00 2001 From: Rostunov Sergey Date: Sun, 12 Dec 2021 21:30:14 +0300 Subject: [PATCH 3/3] Fix compatibility of php 8.1 --- src/RunTracy/Templates/VendorVersionsPanel.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/RunTracy/Templates/VendorVersionsPanel.phtml b/src/RunTracy/Templates/VendorVersionsPanel.phtml index f51efda..67e799e 100644 --- a/src/RunTracy/Templates/VendorVersionsPanel.phtml +++ b/src/RunTracy/Templates/VendorVersionsPanel.phtml @@ -3,7 +3,7 @@ use Tracy\Helpers; function h($str) { - return htmlspecialchars($str, ENT_QUOTES | ENT_HTML5, 'UTF-8'); + return htmlspecialchars((string)$str, ENT_QUOTES | ENT_HTML5, 'UTF-8'); } /**