mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Fix various warnings in PHP 8.0
This commit is contained in:
parent
f46b41f437
commit
60465fb2db
23 changed files with 65 additions and 55 deletions
|
|
@ -45,6 +45,7 @@ class Formatter
|
|||
{
|
||||
$lines = preg_replace('!(<br />)+\s*$!', '', nl2br(escape(trim($text))));
|
||||
$lines = preg_split('!(<br />\s*)+<br />!', $lines);
|
||||
$result = '';
|
||||
foreach ($lines as $line)
|
||||
{
|
||||
$result .= "<p>\n" . trim($line) . "\n</p>\n";
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class SessionHelper
|
|||
{
|
||||
$oMemberModel = \MemberModel::getInstance();
|
||||
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
||||
if (intval($member_info->member_srl) === $member_srl)
|
||||
if (isset($member_info->member_srl) && intval($member_info->member_srl) === $member_srl)
|
||||
{
|
||||
foreach (get_object_vars($member_info) as $key => $value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class DBQueryParser extends BaseParser
|
|||
$attribs = self::_getAttributes($xml);
|
||||
$query = new DBQuery\Query;
|
||||
$query->name = $name ?: null;
|
||||
$query->type = strtoupper($attribs['action']) ?: 'SELECT';
|
||||
$query->type = strtoupper($attribs['action'] ?? '') ?: 'SELECT';
|
||||
$query->alias = $attribs['alias'] ?? null;
|
||||
if ($query->alias && !$query->name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class DBTableParser extends BaseParser
|
|||
{
|
||||
$index->type = strtoupper($index_info['type']);
|
||||
}
|
||||
elseif (toBool($index_info['unique']))
|
||||
elseif (isset($index_info['unique']) && toBool($index_info['unique']))
|
||||
{
|
||||
$index->type = 'UNIQUE';
|
||||
}
|
||||
|
|
@ -202,12 +202,12 @@ class DBTableParser extends BaseParser
|
|||
{
|
||||
$const_info = self::_getAttributes($const_info);
|
||||
$constraint = new DBTable\Constraint;
|
||||
$constraint->type = strtoupper($const_info['type']);
|
||||
$constraint->column = $const_info['column'] ?: null;
|
||||
$constraint->references = $const_info['references'] ?: null;
|
||||
$constraint->condition = $const_info['condition'] ?: null;
|
||||
$constraint->on_delete = $const_info['ondelete'] ?: $constraint->on_delete;
|
||||
$constraint->on_update = $const_info['onupdate'] ?: $constraint->on_update;
|
||||
$constraint->type = strtoupper($const_info['type'] ?? '');
|
||||
$constraint->column = ($const_info['column'] ?? null) ?: null;
|
||||
$constraint->references = ($const_info['references'] ?? null) ?: null;
|
||||
$constraint->condition = ($const_info['condition'] ?? null) ?: null;
|
||||
$constraint->on_delete = ($const_info['ondelete'] ?? null) ?: $constraint->on_delete;
|
||||
$constraint->on_update = ($const_info['onupdate'] ?? null) ?: $constraint->on_update;
|
||||
$table->constraints[] = $constraint;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,8 +267,8 @@ class Router
|
|||
$matches = array_filter($matches, 'is_string', \ARRAY_FILTER_USE_KEY);
|
||||
$allargs = array_merge($args, $matches, $route_info['extra_vars'] ?? []);
|
||||
$result->module = $allargs['module'] ?? '';
|
||||
$result->mid = $allargs['mid'] ?: '';
|
||||
$result->act = $allargs['act'] ?: '';
|
||||
$result->mid = ($allargs['mid'] ?? '') ?: '';
|
||||
$result->act = ($allargs['act'] ?? '') ?: '';
|
||||
$result->forwarded = false;
|
||||
$result->args = $allargs;
|
||||
return $result;
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ class Session
|
|||
public static function checkSSO($site_module_info)
|
||||
{
|
||||
// Abort if SSO is disabled, the visitor is a robot, or this is not a typical GET request.
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'GET' || !config('use_sso') || UA::isRobot() || in_array(\Context::get('act'), array('rss', 'atom')))
|
||||
if (!isset($_SERVER['REQUEST_METHOD']) || $_SERVER['REQUEST_METHOD'] !== 'GET' || !config('use_sso') || UA::isRobot() || in_array(\Context::get('act'), array('rss', 'atom')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -509,11 +509,11 @@ class Session
|
|||
public static function close()
|
||||
{
|
||||
// Restore member_srl from XE-compatible variable if it has changed.
|
||||
if ($_SESSION['RHYMIX'] && $_SESSION['RHYMIX']['login'] !== intval($_SESSION['member_srl']))
|
||||
if (isset($_SESSION['RHYMIX']) && $_SESSION['RHYMIX'] && $_SESSION['RHYMIX']['login'] !== intval($_SESSION['member_srl']))
|
||||
{
|
||||
$_SESSION['RHYMIX']['login'] = intval($_SESSION['member_srl']);
|
||||
$_SESSION['RHYMIX']['login'] = intval($_SESSION['member_srl'] ?? 0);
|
||||
$_SESSION['RHYMIX']['last_login'] = time();
|
||||
$_SESSION['is_logged'] = (bool)$member_srl;
|
||||
$_SESSION['is_logged'] = (bool)($_SESSION['member_srl'] ?? 0);
|
||||
}
|
||||
|
||||
// Close the session and write it to disk.
|
||||
|
|
@ -725,7 +725,7 @@ class Session
|
|||
*/
|
||||
public static function getMemberSrl()
|
||||
{
|
||||
return $_SESSION['member_srl'] ?: ($_SESSION['RHYMIX']['login'] ?: false);
|
||||
return ($_SESSION['member_srl'] ?? 0) ?: (($_SESSION['RHYMIX']['login'] ?? false) ?: false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1016,7 +1016,7 @@ class Session
|
|||
*/
|
||||
public static function encrypt($plaintext)
|
||||
{
|
||||
$key = $_SESSION['RHYMIX']['secret'] . Config::get('crypto.encryption_key');
|
||||
$key = ($_SESSION['RHYMIX']['secret'] ?? '') . Config::get('crypto.encryption_key');
|
||||
return Security::encrypt($plaintext, $key);
|
||||
}
|
||||
|
||||
|
|
@ -1031,7 +1031,7 @@ class Session
|
|||
*/
|
||||
public static function decrypt($ciphertext)
|
||||
{
|
||||
$key = $_SESSION['RHYMIX']['secret'] . Config::get('crypto.encryption_key');
|
||||
$key = ($_SESSION['RHYMIX']['secret'] ?? '') . Config::get('crypto.encryption_key');
|
||||
return Security::decrypt($ciphertext, $key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ class UA
|
|||
if (preg_match('#Android ([0-9\.]+);(?: ([^;]+) Build/)?#', $ua, $matches))
|
||||
{
|
||||
$result->os_version = $matches[1];
|
||||
$result->device = $matches[2] ?: null;
|
||||
$result->device = isset($matches[2]) ? ($matches[2] ?: null) : null;
|
||||
}
|
||||
}
|
||||
elseif ($matches[1] === 'iPhone' || $matches[1] === 'iPad' || $matches[1] === 'iPod')
|
||||
|
|
@ -358,7 +358,7 @@ class UA
|
|||
if (preg_match('#^([a-zA-Z0-9_-]+)(?:/([0-9]+\\.[0-9]+))?#', $ua, $matches))
|
||||
{
|
||||
$result->browser = ucfirst($matches[1]);
|
||||
$result->version = $matches[2] ?: null;
|
||||
$result->version = isset($matches[2]) ? ($matches[2] ?: null) : null;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class URL
|
|||
public static function modifyURL($url, array $changes = array())
|
||||
{
|
||||
$url = parse_url(self::getCanonicalURL($url));
|
||||
$prefix = sprintf('%s://%s%s%s', $url['scheme'], $url['host'], ($url['port'] ? (':' . $url['port']) : ''), $url['path']);
|
||||
$prefix = sprintf('%s://%s%s%s', $url['scheme'], $url['host'], (($url['port'] ?? '') ? (':' . $url['port']) : ''), $url['path']);
|
||||
parse_str($url['query'], $args);
|
||||
$changes = array_merge($args, $changes);
|
||||
$changes = array_filter($changes, function($val) { return $val !== null; });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue