N°6562 Replace new DOMText() by \DOMDocument::createTextNode

Because init using constructor outputs a read only node, see https://www.php.net/manual/en/domelement.construct.php
Thanks @Hipska
See conversation in 734a788
This commit is contained in:
Pierre Goiffon
2023-08-03 09:40:39 +02:00
parent 7aa478d6ff
commit 880a824f2f

View File

@@ -895,7 +895,9 @@ class iTopDesignFormat
// N°6562 textContent is readonly, see https://www.php.net/manual/en/class.domnode.php#95545
// $oNode->textContent = $sCode;
// N°6562 to update text node content we must use the node methods !
$oTextContentNode = new DOMText($sCode);
// we are using DOMDocument::createTextNode instead of new DOMText because elements created using the constructor are read only
// see https://www.php.net/manual/en/domelement.construct.php
$oTextContentNode = $this->oDocument->createTextNode($sCode);
$oNode->appendChild($oTextContentNode);
}
}