diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 5831ffb14..77c4f876d 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -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. diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php index 57de64d19..272676f22 100644 --- a/classes/file/FileHandler.class.php +++ b/classes/file/FileHandler.class.php @@ -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(); diff --git a/classes/frontendfile/FrontEndFileHandler.class.php b/classes/frontendfile/FrontEndFileHandler.class.php index 0f7ee6321..c2bedc121 100644 --- a/classes/frontendfile/FrontEndFileHandler.class.php +++ b/classes/frontendfile/FrontEndFileHandler.class.php @@ -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(); diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 9df159570..8dc4d61bb 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -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; diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 4616fa8b1..ec80ddfd5 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -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; diff --git a/classes/xml/XmlParser.class.php b/classes/xml/XmlParser.class.php index 90cb46ec4..da94acdf7 100644 --- a/classes/xml/XmlParser.class.php +++ b/classes/xml/XmlParser.class.php @@ -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; diff --git a/common/framework/debug.php b/common/framework/debug.php index c44e602b8..9808c7f4d 100644 --- a/common/framework/debug.php +++ b/common/framework/debug.php @@ -768,7 +768,7 @@ class Debug 'url' => getCurrentPageUrl(), 'request' => (object)array( 'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''), - 'size' => intval($_SERVER['CONTENT_LENGTH']), + 'size' => intval($_SERVER['CONTENT_LENGTH'] ?? 0), ), 'response' => (object)array( 'method' => \Context::getResponseMethod(), @@ -776,15 +776,15 @@ class Debug ), 'timing' => (object)array( 'total' => sprintf('%0.4f sec', microtime(true) - \RX_MICROTIME), - 'template' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']), - 'xmlparse' => sprintf('%0.4f sec', $GLOBALS['__xmlparse_elapsed__']), + 'template' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__template_elapsed__'] ?? 0, $GLOBALS['__TemplateHandlerCalled__'] ?? 0), + 'xmlparse' => sprintf('%0.4f sec', $GLOBALS['__xmlparse_elapsed__'] ?? 0), 'db_query' => sprintf('%0.4f sec (count: %d)', self::$_query_time, count(self::$_queries)), 'db_class' => sprintf('%0.4f sec', max(0, $db->getTotalElapsedTime() - self::$_query_time)), 'session' => sprintf('%0.4f sec', self::$_session_time), - 'layout' => sprintf('%0.4f sec', $GLOBALS['__layout_compile_elapsed__']), - 'widget' => sprintf('%0.4f sec', $GLOBALS['__widget_excute_elapsed__']), - 'remote' => sprintf('%0.4f sec', $GLOBALS['__remote_request_elapsed__']), - 'trans' => sprintf('%0.4f sec', $GLOBALS['__trans_content_elapsed__']), + 'layout' => sprintf('%0.4f sec', $GLOBALS['__layout_compile_elapsed__'] ?? 0), + 'widget' => sprintf('%0.4f sec', $GLOBALS['__widget_excute_elapsed__'] ?? 0), + 'remote' => sprintf('%0.4f sec', $GLOBALS['__remote_request_elapsed__'] ?? 0), + 'trans' => sprintf('%0.4f sec', $GLOBALS['__trans_content_elapsed__'] ?? 0), ), 'entries' => self::$_entries, 'errors' => self::$_errors, diff --git a/common/framework/parsers/dbqueryparser.php b/common/framework/parsers/dbqueryparser.php index 5c37bbd21..445de8d7b 100644 --- a/common/framework/parsers/dbqueryparser.php +++ b/common/framework/parsers/dbqueryparser.php @@ -50,8 +50,8 @@ class DBQueryParser extends BaseParser // Load attributes that only apply to subqueries in the block. $query->operation = $attribs['operation'] ?? null; - $query->column = preg_replace('/[^a-z0-9_\.]/i', '', $attribs['column']) ?: null; - $query->pipe = strtoupper($attribs['pipe']) ?: 'AND'; + $query->column = preg_replace('/[^a-z0-9_\.]/i', '', $attribs['column'] ?? null) ?: null; + $query->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND'; // Load tables. foreach ($xml->tables ? $xml->tables->children() : [] as $tag) @@ -108,13 +108,13 @@ class DBQueryParser extends BaseParser $attribs = self::_getAttributes($tag); $column = new DBQuery\ColumnWrite; $column->name = $attribs['name']; - $column->operation = $attribs['operation'] ?: 'equal'; + $column->operation = ($attribs['operation'] ?? null) ?: 'equal'; $column->var = $attribs['var'] ?? null; $column->default = $attribs['default'] ?? null; - $column->not_null = $attribs['notnull'] ? true : false; + $column->not_null = ($attribs['notnull'] ?? false) ? true : false; $column->filter = $attribs['filter'] ?? null; - $column->minlength = intval($attribs['minlength'], 10); - $column->maxlength = intval($attribs['maxlength'], 10); + $column->minlength = intval($attribs['minlength'] ?? 0, 10); + $column->maxlength = intval($attribs['maxlength'] ?? 0, 10); $query->columns[] = $column; } } @@ -225,18 +225,18 @@ class DBQueryParser extends BaseParser $cond->var = $attribs['var'] ?? null; $cond->default = $attribs['default'] ?? null; } - $cond->not_null = $attribs['notnull'] ? true : false; + $cond->not_null = ($attribs['notnull'] ?? false) ? true : false; $cond->filter = $attribs['filter'] ?? null; - $cond->minlength = intval($attribs['minlength'], 10); - $cond->maxlength = intval($attribs['maxlength'], 10); - $cond->pipe = strtoupper($attribs['pipe']) ?: 'AND'; + $cond->minlength = intval($attribs['minlength'] ?? 0, 10); + $cond->maxlength = intval($attribs['maxlength'] ?? 0, 10); + $cond->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND'; $result[] = $cond; } elseif ($name === 'group') { $group = new DBQuery\ConditionGroup; $group->conditions = self::_parseConditions($tag); - $group->pipe = strtoupper($attribs['pipe']) ?: 'AND'; + $group->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND'; $result[] = $group; } elseif ($name === 'query') diff --git a/modules/widget/widget.controller.php b/modules/widget/widget.controller.php index 61411895a..3f807929b 100644 --- a/modules/widget/widget.controller.php +++ b/modules/widget/widget.controller.php @@ -647,6 +647,10 @@ class widgetController extends widget // Debug widget creation time information added to the results $elapsed_time = microtime(true) - $start; + if (!isset($GLOBALS['__widget_excute_elapsed__'])) + { + $GLOBALS['__widget_excute_elapsed__'] = 0; + } $GLOBALS['__widget_excute_elapsed__'] += $elapsed_time; Rhymix\Framework\Debug::addWidget(array( 'name' => $widget,