From 734a78834055a559aa0b02e30ad9abe75ed95556 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 1 Aug 2023 10:52:56 +0200 Subject: [PATCH 1/2] =?UTF-8?q?N=C2=B06562=20Fix=20DOMNode->textContent=20?= =?UTF-8?q?write=20This=20attribute=20is=20read=20only=20Causes=20layout?= =?UTF-8?q?=20issues=20on=20PHP=208.1.21=20and=208.2.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/itopdesignformat.class.inc.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup/itopdesignformat.class.inc.php b/setup/itopdesignformat.class.inc.php index 925b5a090..6bb760848 100644 --- a/setup/itopdesignformat.class.inc.php +++ b/setup/itopdesignformat.class.inc.php @@ -798,7 +798,10 @@ class iTopDesignFormat $oNodeList = $oXPath->query("/itop_design/classes//class/fields/field/values/value"); foreach ($oNodeList as $oNode) { $sCode = $oNode->textContent; - $oNode->textContent = ''; + // N°6562 textContent is readonly, see https://www.php.net/manual/en/class.domnode.php#95545 +// $oNode->textContent = ''; + // N°6562 to update text node content we must use the node methods ! + $oNode->removeChild($oNode->firstChild); $oCodeNode = $oNode->ownerDocument->createElement("code", $sCode); $oNode->appendChild($oCodeNode); } @@ -888,7 +891,12 @@ class iTopDesignFormat if ($oStyleNode) { $this->DeleteNode($oStyleNode); } - $oNode->textContent = $sCode; + + // 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); + $oNode->appendChild($oTextContentNode); } } // - Style From 97700dbf15dcfcfc47da8ca8f1b6e8124a0b27eb Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Thu, 27 Jul 2023 09:48:21 +0200 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06562=20Re-enable=20failing=20tests?= =?UTF-8?q?=20Conditional=20disabling=20was=20made=20in=20ea8e7c5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setup/iTopDesignFormat/iTopDesignFormatTest.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php b/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php index c04b9c224..e83fc9ca2 100644 --- a/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/iTopDesignFormat/iTopDesignFormatTest.php @@ -57,12 +57,6 @@ class iTopDesignFormatTest extends ItopTestCase $sInputXml = $this->GetFileContent($sSamplesRelDirPath.$sXmlFileName.'.input'); $oInputDesignFormat = static::GetItopFormatFromString($sInputXml); - // N°6562 Disable test for 1.7 => 3.0 conversion on PHP 8.1.21 / 8.2.8 as it is failing due to unknown reason. Cause will be investigated next week. - if ((PHP_VERSION_ID === 80121 || PHP_VERSION_ID === 80208) - && $oInputDesignFormat->GetVersion() === "1.7" && $sTargetVersion === "3.0") { - $this->markTestSkipped("Skip test for 1.7 => 3.0 conversion on PHP 8.1.21 as it is failing due to unknown reason. Cause will be investigated next week."); - } - $bResult = $oInputDesignFormat->Convert($sTargetVersion); $aErrors = $oInputDesignFormat->GetErrors(); $this->assertCount($iExpectedErrors, $aErrors, @@ -107,12 +101,6 @@ class iTopDesignFormatTest extends ItopTestCase $oExpectedDesignFormat = static::GetItopFormatFromString($sExpectedXml); $sExpectedVersion = $oExpectedDesignFormat->GetVersion(); - // N°6562 Disable test for 1.7 => 3.0 conversion on PHP 8.1.21 / 8.2.8 as it is failing due to unknown reason. Cause will be investigated next week. - if ((PHP_VERSION_ID === 80121 || PHP_VERSION_ID === 80208) - && $sInputVersion === "1.7" && $sExpectedVersion === "3.0") { - $this->markTestSkipped("Skip test for 1.7 => 3.0 conversion on PHP 8.1.21 as it is failing due to unknown reason. Cause will be investigated next week."); - } - if (version_compare($sInputVersion, $sExpectedVersion, '>=')) { $this->markTestSkipped("This dataset correspond to a downward conversion ($sInputVersion to $sExpectedVersion) and we want to test upwards conversions => skipping !"); }