From e0dd7674fd21dd6dfb89697837b38f124e0320e1 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Tue, 21 Feb 2023 14:45:09 +1300 Subject: [PATCH] ENH Ensure deprecation notices are collected --- code/DebugBar.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/DebugBar.php b/code/DebugBar.php index 5ff2c24..9645f8c 100644 --- a/code/DebugBar.php +++ b/code/DebugBar.php @@ -46,6 +46,7 @@ use LeKoala\DebugBar\Collector\SilverStripeCollector; use SilverStripe\Config\Collections\DeltaConfigCollection; use SilverStripe\Config\Collections\CachedConfigCollection; +use SilverStripe\Dev\Deprecation; /** * A simple helper @@ -402,6 +403,13 @@ public static function renderDebugBar() $initialize = false; } + // Normally deprecation notices are output in a shutdown function, which runs well after debugbar has rendered. + // This ensures the deprecation notices which have been noted up to this point are logged out and collected by + // the MonologCollector. + if (method_exists(Deprecation::class, 'outputNotices')) { + Deprecation::outputNotices(); + } + $script = self::$renderer->render($initialize); return $script; }