From e8c5ee02d2f353402f4cb6f5dbdc2a1a3f42ba3f Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 22 Feb 2021 22:32:36 +0900 Subject: [PATCH] Fix error in PHP 8.0 if $INPUT_ERROR has more than one dimension --- classes/display/HTMLDisplayHandler.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 82e029632..ff831d1d1 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -239,9 +239,9 @@ class HTMLDisplayHandler // prevent the 2nd request due to url(none) of the background-image $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); - if(is_array(Context::get('INPUT_ERROR'))) + $INPUT_ERROR = Context::get('INPUT_ERROR'); + if(is_array($INPUT_ERROR) && count($INPUT_ERROR)) { - $INPUT_ERROR = Context::get('INPUT_ERROR'); $keys = array_map(function($str) { return preg_quote($str, '@'); }, array_keys($INPUT_ERROR)); $keys = '(' . implode('|', $keys) . ')'; @@ -288,6 +288,10 @@ class HTMLDisplayHandler function _preserveValue($match) { $INPUT_ERROR = Context::get('INPUT_ERROR'); + if (!is_scalar($INPUT_ERROR[$match[3]])) + { + return $match[0]; + } $str = $match[1] . $match[2] . ' name="' . $match[3] . '"' . $match[4];