Includes: Workaround for PHP 8.3.14 bug
Changed DOMText creation to be done via document so its document reference is correct to avoid a bug in PHP 8.3.14. Ref: https://github.com/php/php-src/issues/16967 Fixes #5341
This commit is contained in:
parent
68ce340741
commit
415cd6a360
|
@ -104,10 +104,10 @@ class PageIncludeParser
|
|||
|
||||
if ($currentOffset < $tagStartOffset) {
|
||||
$previousText = substr($text, $currentOffset, $tagStartOffset - $currentOffset);
|
||||
$textNode->parentNode->insertBefore(new DOMText($previousText), $textNode);
|
||||
$textNode->parentNode->insertBefore($this->doc->createTextNode($previousText), $textNode);
|
||||
}
|
||||
|
||||
$node = $textNode->parentNode->insertBefore(new DOMText($tagOuterContent), $textNode);
|
||||
$node = $textNode->parentNode->insertBefore($this->doc->createTextNode($tagOuterContent), $textNode);
|
||||
$includeTags[] = new PageIncludeTag($tagInnerContent, $node);
|
||||
$currentOffset = $tagStartOffset + strlen($tagOuterContent);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ use DOMDocument;
|
|||
use DOMElement;
|
||||
use DOMNode;
|
||||
use DOMNodeList;
|
||||
use DOMText;
|
||||
use DOMXPath;
|
||||
|
||||
/**
|
||||
|
@ -81,6 +82,14 @@ class HtmlDocument
|
|||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new text node within this document.
|
||||
*/
|
||||
public function createTextNode(string $text): DOMText
|
||||
{
|
||||
return $this->document->createTextNode($text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an element within the document of the given ID.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue