Skip to content

Commit 8c338d6

Browse files
Merge branch '5.4' into 6.0
* 5.4: [PropertyInfo] CS fix [Serializer] Try all possible denormalization route with union types when ALLOW_EXTRA_ATTRIBUTES=false CS fix [Cache] Respect $save option in ChainAdapter [ExpressionLanguage] fix tests (bis) [ExpressionLanguage] fix tests [Cache] Respect $save option in ArrayAdapter [HttpKernel] Disable session tracking while collecting profiler data [MonologBridge] Fixed support of elasticsearch 7.+ in ElasticsearchLogstashHandler [DoctrineBridge] Extend type guessing on enum fields [Messenger] move resetting services at worker stopped into ResetServicesListener [Mailer] Fix Error Handling for OhMySMTP Bridge Fix for missing sender name in case with usage of the EnvelopeListener
2 parents 6b74c7f + 0126a35 commit 8c338d6

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

DataCollector/MemoryDataCollector.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,8 @@ private function convertToBytes(string $memoryLimit): int|float
9494

9595
switch (substr($memoryLimit, -1)) {
9696
case 't': $max *= 1024;
97-
// no break
9897
case 'g': $max *= 1024;
99-
// no break
10098
case 'm': $max *= 1024;
101-
// no break
10299
case 'k': $max *= 1024;
103100
}
104101

EventListener/ProfilerListener.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\HttpFoundation\Request;
1616
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
1717
use Symfony\Component\HttpFoundation\RequestStack;
18+
use Symfony\Component\HttpFoundation\Session\Session;
1819
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
1920
use Symfony\Component\HttpKernel\Event\ResponseEvent;
2021
use Symfony\Component\HttpKernel\Event\TerminateEvent;
@@ -96,8 +97,21 @@ public function onKernelResponse(ResponseEvent $event)
9697
return;
9798
}
9899

99-
if (!$profile = $this->profiler->collect($request, $event->getResponse(), $exception)) {
100-
return;
100+
$session = $request->hasPreviousSession() && $request->hasSession() ? $request->getSession() : null;
101+
102+
if ($session instanceof Session) {
103+
$usageIndexValue = $usageIndexReference = &$session->getUsageIndex();
104+
$usageIndexReference = \PHP_INT_MIN;
105+
}
106+
107+
try {
108+
if (!$profile = $this->profiler->collect($request, $event->getResponse(), $exception)) {
109+
return;
110+
}
111+
} finally {
112+
if ($session instanceof Session) {
113+
$usageIndexReference = $usageIndexValue;
114+
}
101115
}
102116

103117
$this->profiles[$request] = $profile;

0 commit comments

Comments
 (0)