Skip to content

Commit 1b62f39

Browse files
committed
refactor: add a backward-compatible fallback
1 parent ad92ff5 commit 1b62f39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

system/Debug/Toolbar.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,10 @@ protected function format(string $data, string $format = 'html'): string
554554
*/
555555
private function shouldDisableToolbar(IncomingRequest $request): bool
556556
{
557-
foreach ($this->config->disableOnHeaders as $headerName => $expectedValue) {
557+
// Fallback for older installations where the config option is missing (e.g. after upgrading from a previous version).
558+
$headers = $this->config->disableOnHeaders ?? ['X-Requested-With' => 'xmlhttprequest'];
559+
560+
foreach ($headers as $headerName => $expectedValue) {
558561
if (! $request->hasHeader($headerName)) {
559562
continue; // header not present, skip
560563
}

0 commit comments

Comments
 (0)