Fix error in PHP 8.0 if $INPUT_ERROR has more than one dimension

This commit is contained in:
Kijin Sung 2021-02-22 22:32:36 +09:00
parent 4fe083b3c7
commit e8c5ee02d2

View file

@ -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];