Phpspreadsheet: Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity,

Created on 27 Aug 2018  路  4Comments  路  Source: PHPOffice/PhpSpreadsheet

To prevent third-party libs which use PhpSpreadsheet from failing on warnings, I think there needs to be a modification to suppress parse warnings either permanently or via a flag

_phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Html.php:546_

$dom = new DOMDocument();
// Reload the HTML file into the DOM object
$internalErrors = libxml_use_internal_errors(true);
$loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanFile($pFilename), 'HTML-ENTITIES', 'UTF-8'));
libxml_use_internal_errors($internalErrors);
if ($loaded === false) {
throw new Exception('Failed to load ' . $pFilename . ' as a DOM Document');
}

https://stackoverflow.com/questions/1685277/warning-domdocumentloadhtml-htmlparseentityref-expecting-in-entity

stale

Most helpful comment

Why nothing was changed? There is still problem with HtmlLoading and its failing because of it.

All 4 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

Why nothing was changed? There is still problem with HtmlLoading and its failing because of it.

Yes, that's still a problem. I'm wondering why not more people have this issue!?

when i upgrade laravel 5.8 to 6.0, i had got same error

DOMDocument::loadHTML(): htmlParseEntityRef: expecting ';' in Entity, line: 19

public function loadIntoExisting($pFilename, Spreadsheet $spreadsheet)
{
    // Validate
    if (!$this->canRead($pFilename)) {
        throw new Exception($pFilename . ' is an Invalid HTML file.');
    }

    // Create a new DOM object
    $dom = new DOMDocument();
    // Reload the HTML file into the DOM object
    $loaded = $dom->loadHTML(mb_convert_encoding($this->securityScanner->scanFile($pFilename), 'HTML-ENTITIES', 'UTF-8'));
    if ($loaded === false) {
        throw new Exception('Failed to load ' . $pFilename . ' as a DOM Document');
    }

    return $this->loadDocument($dom, $spreadsheet);
}

/**
 * Spreadsheet from content.
 *
 * @param string $content
Was this page helpful?
0 / 5 - 0 ratings

Related issues

PowerKiKi picture PowerKiKi  路  5Comments

stratboy picture stratboy  路  5Comments

sadlyblue picture sadlyblue  路  3Comments

PowerKiKi picture PowerKiKi  路  5Comments

leandrogm picture leandrogm  路  5Comments