Skip to content

Commit 48266da

Browse files
authored
Revert and fix session manager (#1666)
1 parent 1542461 commit 48266da

File tree

4 files changed

+10
-130
lines changed

4 files changed

+10
-130
lines changed

src/LaravelDebugbar.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,12 @@ public function __construct($app = null)
130130
public function getHttpDriver()
131131
{
132132
if ($this->httpDriver === null) {
133-
if ($this->app->bound('cookie')) {
134-
$this->httpDriver = $this->app->make(SessionHttpDriver::class);
135-
} else {
136-
$this->httpDriver = $this->app->make(SymfonyHttpDriver::class);
137-
}
133+
$this->httpDriver = $this->app->make(SymfonyHttpDriver::class);
138134
}
139135

140136
return $this->httpDriver;
141137
}
142-
138+
143139
/**
144140
* Enable the Debugbar and boot, if not already booted.
145141
*/
@@ -740,6 +736,12 @@ public function modifyResponse(Request $request, Response $response)
740736
// Prevent duplicate modification
741737
$this->responseIsModified = true;
742738

739+
// Set the Response if required
740+
$httpDriver = $this->getHttpDriver();
741+
if ($httpDriver instanceof SymfonyHttpDriver) {
742+
$httpDriver->setResponse($response);
743+
}
744+
743745
// Show the Http Response Exception in the Debugbar, when available
744746
if (isset($response->exception)) {
745747
$this->addThrowable($response->exception);
@@ -757,11 +759,11 @@ public function modifyResponse(Request $request, Response $response)
757759

758760
$sessionHiddens = $app['config']->get('debugbar.options.session.hiddens', []);
759761
if ($app->bound(SessionManager::class)) {
762+
/** @var \Illuminate\Session\SessionManager $sessionManager */
763+
$sessionManager = $app->make(SessionManager::class);
760764

761765
if ($this->shouldCollect('session') && ! $this->hasCollector('session')) {
762766
try {
763-
/** @var \Illuminate\Session\SessionManager $sessionManager */
764-
$sessionManager = $app->make(SessionManager::class);
765767
$this->addCollector(new SessionCollector($sessionManager, $sessionHiddens));
766768
} catch (Exception $e) {
767769
$this->addCollectorException('Cannot add SessionCollector', $e);

src/ServiceProvider.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ public function register()
3535
return new LaravelDebugbar($app);
3636
});
3737

38-
$this->app->singleton(SessionHttpDriver::class, function ($app) {
39-
// Attach the Cookie Handler with Request
40-
$cookieHandler = new CookieSessionHandler($app->make('cookie'), 0, true);
41-
$cookieHandler->setRequest($app['request']);
42-
43-
return new SessionHttpDriver($cookieHandler);
44-
});
45-
4638
$this->app->singleton(SymfonyHttpDriver::class, function ($app) {
4739
return new SymfonyHttpDriver($app->make(SessionManager::class));
4840
});
@@ -176,12 +168,6 @@ protected function registerResponseListener()
176168
/** @var LaravelDebugbar $debugbar */
177169
$debugbar = $this->app->make(LaravelDebugbar::class);
178170
if ($debugbar->isEnabled()) {
179-
// Now that we have a Response, set it on the Driver
180-
$httpDriver = $debugbar->getHttpDriver();
181-
if ($httpDriver instanceof SessionHttpDriver || $httpDriver instanceof SymfonyHttpDriver) {
182-
$httpDriver->setResponse($event->response);
183-
}
184-
185171
if ($event->response->isRedirection()) {
186172
$debugbar->modifyResponse($event->request, $event->response);
187173
} else {

src/SessionHttpDriver.php

Lines changed: 0 additions & 107 deletions
This file was deleted.

src/SymfonyHttpDriver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/**
1010
* HTTP driver for Symfony Request/Session
1111
*
12-
* @deprecated
1312
*/
1413
class SymfonyHttpDriver implements HttpDriverInterface
1514
{

0 commit comments

Comments
 (0)