27
27
use Exception ;
28
28
29
29
use Illuminate \Contracts \Foundation \Application ;
30
+ use Illuminate \Session \SessionManager ;
30
31
use Symfony \Component \HttpFoundation \Request ;
31
32
use Symfony \Component \HttpFoundation \Response ;
32
33
@@ -107,8 +108,8 @@ public function boot()
107
108
return ;
108
109
}
109
110
110
- if ($ this ->isDebugbarRequest ()) {
111
- $ this ->app [ ' session ' ] ->reflash ();
111
+ if ($ this ->isDebugbarRequest () && $ this -> app -> bound (SessionManager::class) ) {
112
+ $ this ->app -> make (SessionManager::class) ->reflash ();
112
113
}
113
114
114
115
/** @var \Barryvdh\Debugbar\LaravelDebugbar $debugbar */
@@ -133,14 +134,14 @@ public function boot()
133
134
134
135
if ( ! $ this ->isLumen ()) {
135
136
$ this ->app ->booted (
136
- function () use ($ debugbar , $ startTime ) {
137
- if ($ startTime ) {
138
- $ debugbar ['time ' ]->addMeasure ('Booting ' , $ startTime , microtime (true ));
139
- }
140
- }
137
+ function () use ($ debugbar , $ startTime ) {
138
+ if ($ startTime ) {
139
+ $ debugbar ['time ' ]->addMeasure ('Booting ' , $ startTime , microtime (true ));
140
+ }
141
+ }
141
142
);
142
143
}
143
-
144
+
144
145
$ debugbar ->startMeasure ('application ' , 'Application ' );
145
146
}
146
147
@@ -446,7 +447,6 @@ public function getJavascriptRenderer($baseUrl = null, $basePath = null)
446
447
{
447
448
if ($ this ->jsRenderer === null ) {
448
449
$ this ->jsRenderer = new JavascriptRenderer ($ this , $ baseUrl , $ basePath );
449
- $ this ->jsRenderer ->setUrlGenerator ($ this ->app ['url ' ]);
450
450
}
451
451
return $ this ->jsRenderer ;
452
452
}
@@ -464,7 +464,7 @@ public function modifyResponse(Request $request, Response $response)
464
464
if ($ app ->runningInConsole () || !$ this ->isEnabled () || $ this ->isDebugbarRequest ()) {
465
465
return $ response ;
466
466
}
467
-
467
+
468
468
// Show the Http Response Exception in the Debugbar, when available
469
469
if (isset ($ response ->exception )) {
470
470
$ this ->addException ($ response ->exception );
@@ -486,23 +486,28 @@ public function modifyResponse(Request $request, Response $response)
486
486
}
487
487
}
488
488
489
- /** @var \Illuminate\Session\SessionManager $sessionManager */
490
- $ sessionManager = $ app ['session ' ];
491
- $ httpDriver = new SymfonyHttpDriver ($ sessionManager , $ response );
492
- $ this ->setHttpDriver ($ httpDriver );
489
+ if ($ this ->app ->bound (SessionManager::class)){
493
490
494
- if ($ this ->shouldCollect ('session ' )) {
495
- try {
496
- $ this ->addCollector (new SessionCollector ($ sessionManager ));
497
- } catch (\Exception $ e ) {
498
- $ this ->addException (
499
- new Exception (
500
- 'Cannot add SessionCollector to Laravel Debugbar: ' . $ e ->getMessage (),
501
- $ e ->getCode (),
502
- $ e
503
- )
504
- );
491
+ /** @var \Illuminate\Session\SessionManager $sessionManager */
492
+ $ sessionManager = $ app ->make (SessionManager::class);
493
+ $ httpDriver = new SymfonyHttpDriver ($ sessionManager , $ response );
494
+ $ this ->setHttpDriver ($ httpDriver );
495
+
496
+ if ($ this ->shouldCollect ('session ' )) {
497
+ try {
498
+ $ this ->addCollector (new SessionCollector ($ sessionManager ));
499
+ } catch (\Exception $ e ) {
500
+ $ this ->addException (
501
+ new Exception (
502
+ 'Cannot add SessionCollector to Laravel Debugbar: ' . $ e ->getMessage (),
503
+ $ e ->getCode (),
504
+ $ e
505
+ )
506
+ );
507
+ }
505
508
}
509
+ } else {
510
+ $ sessionManager = null ;
506
511
}
507
512
508
513
if ($ this ->shouldCollect ('symfony_request ' , true ) && !$ this ->hasCollector ('request ' )) {
@@ -525,11 +530,11 @@ public function modifyResponse(Request $request, Response $response)
525
530
$ this ->addCollector (new ClockworkCollector ($ request , $ response , $ sessionManager ));
526
531
} catch (\Exception $ e ) {
527
532
$ this ->addException (
528
- new Exception (
529
- 'Cannot add ClockworkCollector to Laravel Debugbar: ' . $ e ->getMessage (),
530
- $ e ->getCode (),
531
- $ e
532
- )
533
+ new Exception (
534
+ 'Cannot add ClockworkCollector to Laravel Debugbar: ' . $ e ->getMessage (),
535
+ $ e ->getCode (),
536
+ $ e
537
+ )
533
538
);
534
539
}
535
540
@@ -666,7 +671,7 @@ public function injectDebugbar(Response $response)
666
671
667
672
$ renderer = $ this ->getJavascriptRenderer ();
668
673
if ($ this ->getStorage ()) {
669
- $ openHandlerUrl = $ this -> app [ ' url ' ]-> route ('debugbar.openhandler ' );
674
+ $ openHandlerUrl = route ('debugbar.openhandler ' );
670
675
$ renderer ->setOpenHandlerUrl ($ openHandlerUrl );
671
676
}
672
677
0 commit comments