You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a document from HTML, when adding HTML via the static call HTML::addHTML if the content contains a image tag with a p tag. The call fails with the DomDocument exception DOMDocument::loadXML(): Opening and ending tag mismatch.
The HTML was generated via PHP 8.4's HTMLDocument class.
The issue isn’t related to the img tag being inside a p element. The actual problem lies in the unclosed img tag in the HTML that’s passed to Html::addHtml(). When using $dom->saveHtml(), self-closing tags like <img> are outputed without a closing slash, which will cause issues.
To ensure proper formatting and valid output, especially for tags like img, br, and hr, please use $dom->saveXml() instead. This will generate properly closed tags in the output.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug and add attachments
When creating a document from HTML, when adding HTML via the static call
HTML::addHTML
if the content contains a image tag with a p tag. The call fails with the DomDocument exceptionDOMDocument::loadXML(): Opening and ending tag mismatch
.The HTML was generated via PHP 8.4's HTMLDocument class.
Expected behavior
The HTML is accepted as valid HTML.
Is there an easy way to mitigate this?
Steps to reproduce
PHPWord version(s) where the bug happened
1.3.0
PHP version(s) where the bug happened
8.4
Priority
The text was updated successfully, but these errors were encountered: