From 31fa96ef6671f77a561d4e58b9c434e2aaad135a Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 13 Apr 2022 11:50:04 +1200 Subject: [PATCH] ENH PHP 8.1 compatibility --- src/IFramePage.php | 4 ++-- src/IFramePageController.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/IFramePage.php b/src/IFramePage.php index bd11733..2715c52 100644 --- a/src/IFramePage.php +++ b/src/IFramePage.php @@ -142,8 +142,8 @@ class IFramePage extends Page //whitelist allowed URL schemes $allowed_schemes = array('http', 'https'); - if ($matches = parse_url($this->IFrameURL)) { - if (isset($matches['scheme']) && !in_array($matches['scheme'], $allowed_schemes)) { + if ($matches = parse_url($this->IFrameURL ?? '')) { + if (isset($matches['scheme']) && !in_array($matches['scheme'], $allowed_schemes ?? [])) { $result->addError(_t(__CLASS__ . '.VALIDATION_BANNEDURLSCHEME', "This URL scheme is not allowed.")); } } diff --git a/src/IFramePageController.php b/src/IFramePageController.php index 2050a1e..6a5ea22 100644 --- a/src/IFramePageController.php +++ b/src/IFramePageController.php @@ -16,8 +16,8 @@ class IFramePageController extends PageController if ($desiredProtocol && $currentProtocol !== $desiredProtocol) { $enforcedLocation = preg_replace( "#^${currentProtocol}#", - $desiredProtocol, - $this->AbsoluteLink() + $desiredProtocol ?? '', + $this->AbsoluteLink() ?? '' ); return $this->redirect($enforcedLocation); }