More fixes to improve PHP 8.0 compatibility

This commit is contained in:
Kijin Sung 2020-10-31 00:40:28 +09:00
parent 8c161bc28d
commit 417e4d15b0
9 changed files with 41 additions and 30 deletions

View file

@ -141,7 +141,7 @@ class DisplayHandler extends Handler
ModuleHandler::triggerCall('display', 'after', $output);
// Output the page content and debug data.
$debug = $this->getDebugInfo($output);
$debug = self::getDebugInfo($output);
print $output;
print $debug;
}
@ -151,7 +151,7 @@ class DisplayHandler extends Handler
*
* @return string
*/
public function getDebugInfo(&$output = null)
public static function getDebugInfo(&$output = null)
{
// Check if debugging information has already been printed.

View file

@ -333,6 +333,10 @@ class FileHandler
$start_time = microtime(true);
$response = Requests::request($url, $request_headers, $body ?: $post_data, $method, $request_options);
$elapsed_time = microtime(true) - $start_time;
if (!isset($GLOBALS['__remote_request_elapsed__']))
{
$GLOBALS['__remote_request_elapsed__'] = 0;
}
$GLOBALS['__remote_request_elapsed__'] += $elapsed_time;
$log = array();

View file

@ -99,7 +99,7 @@ class FrontEndFileHandler extends Handler
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
// Prevent overwriting common scripts.
if(intval($args[3]) > -1500000000)
if(isset($args[3]) && intval($args[3]) > -1500000000)
{
if($isCommon)
{
@ -114,8 +114,8 @@ class FrontEndFileHandler extends Handler
}
}
$file = $this->getFileInfo($args[0], $args[2], $args[1], $args[4], $isCommon);
$file->index = (int)$args[3];
$file = $this->getFileInfo($args[0], $args[2] ?? '', $args[1] ?? 'all', $args[4] ?? [], $isCommon);
$file->index = (int)($args[3] ?? 0);
$availableExtension = array('css' => 1, 'js' => 1, 'less' => 1, 'scss' => 1);
if(!isset($availableExtension[$file->fileExtension]))
@ -132,7 +132,7 @@ class FrontEndFileHandler extends Handler
}
else if($file->fileExtension == 'js')
{
if($args[1] == 'body')
if(isset($args[1]) && $args[1] == 'body')
{
$map = &$this->jsBodyMap;
$mapIndex = &$this->jsBodyMapIndex;
@ -164,12 +164,6 @@ class FrontEndFileHandler extends Handler
*/
protected function getFileInfo($fileName, $targetIe = '', $media = 'all', $vars = array(), $isCommon = false)
{
static $existsInfo = array();
if(isset($existsInfo[$existsKey]))
{
return $existsInfo[$existsKey];
}
$pathInfo = pathinfo($fileName);
$file = new stdClass();

View file

@ -19,6 +19,7 @@ class ModuleHandler extends Handler
var $act = null;
var $mid = null;
var $document_srl = null;
var $entry = null;
var $route = null;
var $error = null;
var $is_mobile = false;

View file

@ -167,6 +167,10 @@ class TemplateHandler
}
// store the ending time for debug information
if (!isset($GLOBALS['__template_elapsed__']))
{
$GLOBALS['__template_elapsed__'] = 0;
}
$GLOBALS['__template_elapsed__'] += microtime(true) - $start;
return $output;

View file

@ -138,6 +138,10 @@ class XeXmlParser
$output = array_shift($this->output);
// Save compile starting time for debugging
if (!isset($GLOBALS['__xmlparse_elapsed__']))
{
$GLOBALS['__xmlparse_elapsed__'] = 0;
}
$GLOBALS['__xmlparse_elapsed__'] += microtime(true) - $start;
return $output;