Various fixes to improve PHP 8.0 compatibility

- XmlParser 클래스가 PHP 내장 클래스가 되어버려서 XeXmlParser로 변경
- 함수나 파라미터의 형태가 맞지 않아서 치명적인 오류 나는 곳 수정
- undefined 변수 및 배열 키 다수 수정 (치명적인 오류는 아님)
- 계속 수정중...
This commit is contained in:
Kijin Sung 2020-10-31 00:25:26 +09:00
parent 90084efd75
commit 8c161bc28d
38 changed files with 136 additions and 100 deletions

View file

@ -83,6 +83,7 @@ $GLOBALS['RX_AUTOLOAD_FILE_MAP'] = array_change_key_case(array(
'XmlJsFilter' => 'classes/xml/XmlJsFilter.class.php',
'XmlLangParser' => 'classes/xml/XmlLangParser.class.php',
'XmlParser' => 'classes/xml/XmlParser.class.php',
'XeXmlParser' => 'classes/xml/XmlParser.class.php',
'Bmp' => 'common/libraries/bmp.php',
'Ftp' => 'common/libraries/ftp.php',
'Tar' => 'common/libraries/tar.php',

View file

@ -836,6 +836,10 @@ class DB
$dbtype = $matches[1];
$size = $matches[2];
}
else
{
$size = '';
}
$xetype = Parsers\DBTableParser::getXEType($dbtype, $size ?: '');
// Return the result as an object.

View file

@ -528,6 +528,8 @@ class Query extends VariableBase
{
return '';
}
$page = 0;
$offset = 0;
// Get the offset from the page or offset variable.
if ($navigation->page)

View file

@ -39,7 +39,7 @@ class VariableBase
$value = '(' . $this->getQueryString($prefix, $args) . ')';
$params = $this->getQueryParams();
}
elseif ($this->var && Query::isValidVariable($args[$this->var], $this instanceof ColumnWrite))
elseif ($this->var && Query::isValidVariable($args[$this->var] ?? null, $this instanceof ColumnWrite))
{
if ($args[$this->var] instanceof EmptyString || $args[$this->var] instanceof NullValue)
{
@ -285,7 +285,7 @@ class VariableBase
*/
public function getValue(array $args)
{
if ($this->var && Query::isValidVariable($args[$this->var], $this instanceof ColumnWrite))
if ($this->var && Query::isValidVariable($args[$this->var] ?? null, $this instanceof ColumnWrite))
{
if ($args[$this->var] === '')
{
@ -321,7 +321,7 @@ class VariableBase
public function getDefaultValue()
{
// Get the current column name.
$column = $this instanceof ColumnWrite ? $this->name : $this->column;
$column = $this instanceof ColumnWrite ? $this->name : ($this->column ?? null);
// If the default value is a column name, escape it.
if (strpos($this->default, '.') !== false && Query::isValidColumnName($this->default))
@ -382,7 +382,7 @@ class VariableBase
// Don't apply a filter if there is no variable.
$column = $this instanceof ColumnWrite ? $this->name : $this->column;
$filter = isset($this->filter) ? $this->filter : '';
if (strval($value) === '')
if (!is_array($value) && strval($value) === '')
{
$filter = '';
}

View file

@ -146,7 +146,8 @@ class Router
$prefix_type = 'mid';
// Find the module associated with this prefix.
$action_info = self::_getActionInfoByPrefix($prefix, $module_name = '');
$module_name = '';
$action_info = self::_getActionInfoByPrefix($prefix, $module_name);
if ($action_info === false)
{
$action_info = self::_getActionInfoByModule($prefix);

View file

@ -963,7 +963,7 @@ class Session
public static function getValidityInfo($member_srl)
{
$member_srl = intval($member_srl);
$validity_info = Cache::get(sprintf('session:validity_info:%d', $member_srl), $invalid_before);
$validity_info = Cache::get(sprintf('session:validity_info:%d', $member_srl));
if ($validity_info)
{
return $validity_info;

View file

@ -34,7 +34,7 @@ function config($key, $value = null)
*/
function lang($code, $value = null)
{
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
if (!isset($GLOBALS['lang']) || !$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
{
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(Context::getLangType() ?: config('locale.default_lang') ?: 'ko');
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
@ -554,7 +554,7 @@ function tobool($input)
*/
function countobj($array_or_object)
{
if (is_array($array_or_object))
if (is_array($array_or_object) || $array_or_object instanceof Countable)
{
return count($array_or_object);
}
@ -564,7 +564,7 @@ function countobj($array_or_object)
}
else
{
return @count($array_or_object);
return $array_or_object ? 1 : 0;
}
}

View file

@ -30,10 +30,10 @@
</block>
<!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="{$rss_url}" cond="$rss_url" />
<link rel="alternate" type="application/rss+xml" title="Site RSS" href="{$general_rss_url}" cond="$general_rss_url" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="{$atom_url}" cond="$rss_url" />
<link rel="alternate" type="application/atom+xml" title="Site Atom" href="{$general_atom_url}" cond="$general_rss_url" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="{$rss_url}" cond="isset($rss_url) && $rss_url" />
<link rel="alternate" type="application/rss+xml" title="Site RSS" href="{$general_rss_url}" cond="isset($general_rss_url) && $general_rss_url" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="{$atom_url}" cond="isset($atom_url) && $atom_url" />
<link rel="alternate" type="application/atom+xml" title="Site Atom" href="{$general_atom_url}" cond="isset($general_atom_url) && $general_atom_url" />
<!-- ICONS AND OTHER LINKS -->
<link cond="Context::getCanonicalURL()" rel="canonical" href="{Context::getCanonicalURL()}" />
@ -52,7 +52,7 @@
var current_url = "{\Rhymix\Framework\URL::encodeIdna($current_url)}";
var request_uri = "{\Rhymix\Framework\URL::encodeIdna($request_uri)}";
var current_lang = xe.current_lang = "{$lang_type}";
var current_mid = {json_encode($mid ?: null)};
var current_mid = {json_encode((isset($mid) && $mid) ?: null)};
var http_port = {Context::get("_http_port") ?: 'null'};
var https_port = {Context::get("_https_port") ?: 'null'};
var enforce_ssl = {$site_module_info->security === 'always' ? 'true' : 'false'};