From 964cbc2a8c7977445dc82562d19318897050a39a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Felix=20=C5=A0ulc?= Date: Tue, 10 Jan 2023 08:40:58 +0100 Subject: [PATCH] NetteSessionIntegration: replace getIterator (#4) --- src/Integration/NetteSessionIntegration.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Integration/NetteSessionIntegration.php b/src/Integration/NetteSessionIntegration.php index eb15312..d232005 100644 --- a/src/Integration/NetteSessionIntegration.php +++ b/src/Integration/NetteSessionIntegration.php @@ -2,6 +2,7 @@ namespace Contributte\Sentry\Integration; +use ArrayIterator; use Nette\DI\Container; use Nette\Http\Session; use Sentry\Breadcrumb; @@ -25,8 +26,12 @@ public function setup(HubInterface $hub, Event $event, EventHint $hint): ?Event return $event; } + // @see https://github.com/nette/http/blob/v3.1/src/Http/Session.php + // phpcs:ignore SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable.DisallowedSuperGlobalVariable + $sessionData = $_SESSION['__NF']['DATA'] ?? []; + /** @var array $iterator */ - $iterator = $session->getIterator(); + $iterator = new ArrayIterator(array_keys($sessionData)); $data = []; foreach ($iterator as $section) {