Fix deprecation notices in PHP 8.2 #2064

This commit is contained in:
Kijin Sung 2023-01-16 21:24:59 +09:00
parent 8e2c4b3ef9
commit c07efe7905
7 changed files with 15 additions and 14 deletions

View file

@ -34,19 +34,19 @@ class EditorComponentParser extends BaseParser
// Get basic information.
$info->title = self::_getChildrenByLang($xml, 'title', $lang);
$info->description = self::_getChildrenByLang($xml, 'description', $lang);
$info->version = trim($xml->version);
$info->version = trim($xml->version ?? '');
$info->date = date('Ymd', strtotime($xml->date . 'T12:00:00Z'));
$info->homepage = trim($xml->homepage);
$info->license = trim($xml->license);
$info->license_link = trim($xml->license['link']);
$info->homepage = trim($xml->homepage ?? '');
$info->license = trim($xml->license ?? '');
$info->license_link = trim($xml->license['link'] ?? '');
$info->author = array();
foreach ($xml->author as $author)
{
$author_info = new \stdClass;
$author_info->name = self::_getChildrenByLang($author, 'name', $lang);
$author_info->email_address = trim($author['email_address']);
$author_info->homepage = trim($author['link']);
$author_info->email_address = trim($author['email_address'] ?? '');
$author_info->homepage = trim($author['link'] ?? '');
$info->author[] = $author_info;
}

View file

@ -257,7 +257,7 @@ function escape_dqstr($str)
*/
function explode_with_escape($delimiter, $str, $limit = 0, $escape_char = '\\')
{
if ($limit < 1) $limit = null;
if ($limit < 1) $limit = 0;
$result = array();
$split = preg_split('/(?<!' . preg_quote($escape_char, '/') . ')' . preg_quote($delimiter, '/') . '/', $str, $limit);
foreach ($split as $piece)

View file

@ -835,10 +835,10 @@ function handleError($errno, $errstr, $file, $line, $context)
function getNumberingPath($no, $size = 3)
{
$mod = pow(10, $size);
$output = sprintf('%0' . $size . 'd/', $no % $mod);
$output = sprintf('%0' . $size . 'd/', intval($no % $mod));
if($no >= $mod)
{
$output .= getNumberingPath((int)$no / $mod, $size);
$output .= getNumberingPath(intval($no / $mod), $size);
}
return $output;
}