private function fixLibXML( $html ) {
		// We don't include rules like '&#34;' => '&amp;quot;' because entities had already been
		// normalized by libxml. Using this function with input not sanitized by libxml is UNSAFE!
		$replacements = [
			'&quot;' => '&amp;quot;',
			'&amp;' => '&amp;amp;',
			'&lt;' => '&amp;lt;',
			'&gt;' => '&amp;gt;',
		];
		$html = strtr( $html, $replacements );

		// Just in case the conversion in getDoc() above used named
		// entities that aren't known to html_entity_decode().
		$html = \mb_convert_encoding( $html, 'UTF-8', 'HTML-ENTITIES' );
		return $html;
	}