File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 46
46
use LeKoala \DebugBar \Collector \SilverStripeCollector ;
47
47
use SilverStripe \Config \Collections \DeltaConfigCollection ;
48
48
use SilverStripe \Config \Collections \CachedConfigCollection ;
49
+ use SilverStripe \Dev \Deprecation ;
49
50
50
51
/**
51
52
* A simple helper
@@ -402,6 +403,13 @@ public static function renderDebugBar()
402
403
$ initialize = false ;
403
404
}
404
405
406
+ // Normally deprecation notices are output in a shutdown function, which runs well after debugbar has rendered.
407
+ // This ensures the deprecation notices which have been noted up to this point are logged out and collected by
408
+ // the MonologCollector.
409
+ if (method_exists (Deprecation::class, 'outputNotices ' )) {
410
+ Deprecation::outputNotices ();
411
+ }
412
+
405
413
$ script = self ::$ renderer ->render ($ initialize );
406
414
return $ script ;
407
415
}
Original file line number Diff line number Diff line change @@ -197,15 +197,21 @@ protected static function findSource()
197
197
);
198
198
199
199
$ sources = array ();
200
- foreach ($ traces as $ trace ) {
200
+ foreach ($ traces as $ i => $ trace ) {
201
+ // We need to be able to look ahead one item in the trace, because the class/function values
202
+ // are talking about what is being *called* on this line, not the function this line lives in.
203
+ if (!isset ($ traces [$ i +1 ])) {
204
+ break ;
205
+ }
206
+
201
207
$ file = isset ($ trace ['file ' ]) ? pathinfo ($ trace ['file ' ], PATHINFO_FILENAME ) : null ;
202
- $ class = isset ($ trace [ 'class ' ]) ? $ trace ['class ' ] : null ;
208
+ $ class = isset ($ traces [ $ i + 1 ][ 'class ' ]) ? $ traces [ $ i + 1 ] ['class ' ] : null ;
203
209
$ line = isset ($ trace ['line ' ]) ? $ trace ['line ' ] : null ;
204
- $ function = isset ($ trace [ 'function ' ]) ? $ trace ['function ' ] : null ;
205
- $ type = isset ($ trace [ 'type ' ]) ? $ trace ['type ' ] : ':: ' ;
210
+ $ function = isset ($ traces [ $ i + 1 ][ 'function ' ]) ? $ traces [ $ i + 1 ] ['function ' ] : null ;
211
+ $ type = isset ($ traces [ $ i + 1 ][ 'type ' ]) ? $ traces [ $ i + 1 ] ['type ' ] : ':: ' ;
206
212
207
213
/* @var $object SSViewer */
208
- $ object = isset ($ trace [ 'object ' ]) ? $ trace ['object ' ] : null ;
214
+ $ object = isset ($ traces [ $ i + 1 ][ 'object ' ]) ? $ traces [ $ i + 1 ] ['object ' ] : null ;
209
215
210
216
if (in_array ($ class , $ internalClasses )) {
211
217
continue ;
You can’t perform that action at this time.
0 commit comments