Skip to content

Commit 01a6e4c

Browse files
committed
Merge branch '2' into 3.0
2 parents 40ec35e + 9a590fa commit 01a6e4c

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

code/DebugBar.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
use LeKoala\DebugBar\Collector\SilverStripeCollector;
4747
use SilverStripe\Config\Collections\DeltaConfigCollection;
4848
use SilverStripe\Config\Collections\CachedConfigCollection;
49+
use SilverStripe\Dev\Deprecation;
4950

5051
/**
5152
* A simple helper
@@ -402,6 +403,13 @@ public static function renderDebugBar()
402403
$initialize = false;
403404
}
404405

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+
405413
$script = self::$renderer->render($initialize);
406414
return $script;
407415
}

code/Extension/ProxyDBExtension.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,21 @@ protected static function findSource()
197197
);
198198

199199
$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+
201207
$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;
203209
$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'] : '::';
206212

207213
/* @var $object SSViewer */
208-
$object = isset($trace['object']) ? $trace['object'] : null;
214+
$object = isset($traces[$i+1]['object']) ? $traces[$i+1]['object'] : null;
209215

210216
if (in_array($class, $internalClasses)) {
211217
continue;

0 commit comments

Comments
 (0)