From 0d44b75f3b5d6d41ae83b79c7a4bceae7fbc78b6 Mon Sep 17 00:00:00 2001 From: Nicola Galgano Date: Mon, 27 Dec 2021 19:49:48 +0100 Subject: [PATCH] php 8.1 deprecations (#494) * php 8.1 deprecations * php 8.1 deprecations * Update DataFormatter.php --- src/DebugBar/JavascriptRenderer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DebugBar/JavascriptRenderer.php b/src/DebugBar/JavascriptRenderer.php index 0cad8b0..b61d74f 100644 --- a/src/DebugBar/JavascriptRenderer.php +++ b/src/DebugBar/JavascriptRenderer.php @@ -789,6 +789,8 @@ class JavascriptRenderer return $uris; } + $uri = $uri ?? ''; + if (substr($uri, 0, 1) === '/' || preg_match('/^([a-zA-Z]+:\/\/|[a-zA-Z]:\/|[a-zA-Z]:\\\)/', $uri)) { return $uri; } @@ -805,7 +807,7 @@ class JavascriptRenderer protected function filterAssetArray($array, $type = '') { $types = array('css', 'js', 'inline_css', 'inline_js', 'inline_head'); - $typeIndex = array_search(strtolower($type), $types); + $typeIndex = array_search(strtolower($type ?? ''), $types); return $typeIndex !== false ? $array[$typeIndex] : $array; }