Support » Plugin: XML Sitemaps » DOMDocument::loadXML(): Input is not proper UTF-8

  • Hi, in my debug.log, I found the following:

    [26-Mar-2021 20:11:22 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x72 0x77 in Entity, line: 1012 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 20:11:22 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 28 in Entity, line: 9468 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 20:11:22 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9468 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 23:29:21 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x28 0x4D in Entity, line: 1054 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 23:29:21 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 22 in Entity, line: 9510 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 23:29:21 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9510 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 23:33:15 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x72 0x77 in Entity, line: 982 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 23:33:15 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 28 in Entity, line: 9438 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [26-Mar-2021 23:33:15 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9438 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 00:08:10 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x72 0x77 in Entity, line: 1024 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 00:08:10 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 28 in Entity, line: 9480 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 00:08:10 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9480 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 01:07:14 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x72 0x77 in Entity, line: 1006 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 01:07:14 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 28 in Entity, line: 9462 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 01:07:14 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9462 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 02:32:06 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x72 0x77 in Entity, line: 1090 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 02:32:06 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 28 in Entity, line: 9546 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 02:32:06 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9546 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 03:24:48 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x28 0x4D in Entity, line: 1012 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 03:24:48 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 22 in Entity, line: 9468 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 03:24:48 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9468 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 03:53:48 UTC] PHP Warning:  DOMDocument::loadXML(): Input is not proper UTF-8, indicate encoding !
    Bytes: 0xFF 0xFF 0x72 0x77 in Entity, line: 1024 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 03:53:48 UTC] PHP Warning:  DOMDocument::loadXML(): xmlParseComment: invalid xmlChar value 28 in Entity, line: 9480 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653
    [27-Mar-2021 03:53:48 UTC] PHP Warning:  DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 9480 in /home/yogurt/www/wp-content/plugins/google-sitemap-generator/sitemap-core.php on line 1653

    Is this something I should worry about?

Viewing 5 replies - 1 through 5 (of 5 total)
  • can you tell me how to fix this please

    Thread Starter islp

    (@islp)

    @khuramk:

    I’ve not had the time to seriously debug it. At the moment, the only thing I can tell you is the following:

    as far as I understand, the content of the variable $xmlSource at line 1649 can be a valid XML string or false. I suppose it is not false because if you’d directly pass false you’d get another kind of error (DOMDocument::loadXML(): Empty string supplied as input). Since $html can’t be false, the error doesn’t derive from $html variable being false. There could be something wrong in the content of the $html variable.

    Thread Starter islp

    (@islp)

    @khuramk :

    I temporarily solved this way, that is, this way I see no more warnings in DEBUG.log: anyway, I suggest you to WAIT for an update of the plugin and NOT apply my patch (I’m actually not sure if there can be any consequences):

    if ($html) {
                
    			$xmlSource = ob_get_clean();
    
    			/* temporary patch, just to silence the error */
    			// if $xmlSource is ISO-8859-1, convert it to UTF-8
    			// else I take for granted it is UTF-8
    			$xm = mb_detect_encoding($xmlSource, 'ISO-8859-1', true) ? iconv('ISO-8859-1', 'UTF-8//TRANSLIT', $xmlSource) : $xmlSource;
    			
    			// if the XML string is well formed
    			if (simplexml_load_string($xm) !== false) {
    
    				// Load the XML source
    				$xml = new DOMDocument;
    				$xml->loadXML($xmlSource);
    
    				$xsl = new DOMDocument;
    				$xsl->load($this->GetPluginPath() . "sitemap.xsl");
    
    				// Configure the transformer
    				$proc = new XSLTProcessor;
    				$proc->importStyleSheet($xsl); // attach the xsl rules
    
    				$domTranObj = $proc->transformToDoc($xml);
    
    				// this will also output doctype and comments at top level
    				foreach ($domTranObj->childNodes as $node) echo $domTranObj->saveXML($node) . "\n";
    			}
    		}
    
    		if($packed) ob_end_flush();
    		$this->isActive = false;
    		exit;
    	}

    @auctollo

    Plugin Author Auctollo

    (@auctollo)

    @islp

    Thank you for reaching out and explaining the issue you came across.

    The team is currently working hard on a 5.0 release of the plugin. We have made note of your recommendation and will consider it as a future enhancement.

    Thread Starter islp

    (@islp)

    @auctollo :

    you’re welcome, glad to help 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.