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
if ($currentOffset < $tagStartOffset) {
$previousText = substr($text, $currentOffset, $tagStartOffset - $currentOffset);
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);
}
$includeTags[] = new PageIncludeTag($tagInnerContent, $node);
$currentOffset = $tagStartOffset + strlen($tagOuterContent);
}
use DOMElement;
use DOMNode;
use DOMNodeList;
use DOMElement;
use DOMNode;
use DOMNodeList;
+ /**
+ * 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.
*/
/**
* Get an element within the document of the given ID.
*/