Skip to content

Bug in /vendor/voku/html-min/src/voku/helper/HtmlMin.php #111

@juongithub

Description

@juongithub

Since $protectedChildNodes may itself contain other protected HTML (i.e., other $protectedChildNodesHelper tags), the following lines in /vendor/voku/html-min/src/voku/helper/HtmlMin.php:

if (\strpos($html, $this->protectedChildNodesHelper) !== false) {
    $html = (string) \preg_replace_callback(
        '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
        [$this, 'restoreProtectedHtml'],
        $html
    );
}

should be:

while (\strpos($html, $this->protectedChildNodesHelper) !== false) {
    $html = (string) \preg_replace_callback(
        '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/',
        [$this, 'restoreProtectedHtml'],
        $html
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions