From: Roland Häder Date: Fri, 17 Feb 2023 19:52:04 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a62dc7cb30b3a7edd46ab1ad0b8d68102c0e36c5;p=core.git Continued: - no attributes of an XML element is very common (ops) - fixed variable in debug line - added more debug lines --- diff --git a/framework/main/classes/parser/xml/class_XmlParser.php b/framework/main/classes/parser/xml/class_XmlParser.php index bfbc88f5..a1ee38a7 100644 --- a/framework/main/classes/parser/xml/class_XmlParser.php +++ b/framework/main/classes/parser/xml/class_XmlParser.php @@ -70,6 +70,7 @@ class XmlParser extends BaseParser implements Parseable { */ public function parseXmlContent (string $content) { // Convert all to UTF8 + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: content()=%d - CALLED!', strlen($content))); if (empty($content)) { // No empty content throw new InvalidArgumentException('content is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); @@ -88,6 +89,7 @@ class XmlParser extends BaseParser implements Parseable { $xmlParser = xml_parser_create(); // Force case-folding to on + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: Created xmlParser=%s ...', $xmlParser)); xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, TRUE); // Set UTF-8 @@ -101,6 +103,7 @@ class XmlParser extends BaseParser implements Parseable { xml_set_character_data_handler($xmlParser, 'characterHandler'); // Now parse the XML tree + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: Invoking xml_parse(%s, content()=%d) ...', $xmlParser, strlen($content))); if (!xml_parse($xmlParser, $content)) { // Error found in XML //* DEBUG: */ exit(__METHOD__ . ':
'.htmlentities($content).'
'); @@ -108,7 +111,11 @@ class XmlParser extends BaseParser implements Parseable { } // Free the parser + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: Freeing xmlParser=%s ...', $xmlParser)); xml_parser_free($xmlParser); + + // Trace message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-PARSER: EXIT!'); } } diff --git a/framework/main/classes/stacker/fifo/class_FiFoStacker.php b/framework/main/classes/stacker/fifo/class_FiFoStacker.php index cf590a76..c19b614a 100644 --- a/framework/main/classes/stacker/fifo/class_FiFoStacker.php +++ b/framework/main/classes/stacker/fifo/class_FiFoStacker.php @@ -72,9 +72,6 @@ class FiFoStacker extends BaseStacker implements Stackable { if (empty($stackerName)) { // No empty stack name throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); - } elseif (is_resource($value) || is_array($value) || is_object($value)) { - // Unsupported variable type - throw new InvalidArgumentException(sprintf('value[]=%s is not supported', gettype($value)), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Call the protected method diff --git a/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php b/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php index a7063ec4..60c7ee6c 100644 --- a/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php +++ b/framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php @@ -286,14 +286,14 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine implements Compi $value = parent::readVariable($key, 'general'); // Is this null? - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value[]=%s', gettype($value))); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value[]=%s', gettype($value))); if (is_null($value)) { // Bah, needs fixing. $this->debugInstance(sprintf('[%s:%d]: key=%s returns NULL', __METHOD__, __LINE__, $key)); } // Return value - /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value=%s - EXIT!', $value)); + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value=%s - EXIT!', $value)); return $value; } @@ -354,9 +354,6 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine implements Compi } elseif (empty($element)) { // Throw IAE throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); - } elseif (count($attributes) == 0) { - // Throw IAE - throw new InvalidArgumentException(sprintf('Parameter attributes()=%d is an empty array', count($attributes)), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } // Initial method name which will never be called...