From 064e8ee511b9ba42ad3742e51822605b4bbd6c79 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 21 Mar 2023 09:03:54 +0100 Subject: [PATCH 1/2] :white_check_mark: Fix AttributeDefinitionTest parse error in PHP 7.2 (cherry picked from commit 307edd3f7a3715e2b95e0b4960cf62b23d3f06e4) --- .../core/AttributeDefinitionTest.php | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php index 624642a13..b8abf5d75 100644 --- a/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php +++ b/tests/php-unit-tests/unitary-tests/core/AttributeDefinitionTest.php @@ -2,7 +2,6 @@ namespace Combodo\iTop\Test\UnitTest\Core; -use CMDBSource; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; use MetaModel; @@ -76,7 +75,8 @@ class AttributeDefinitionTest extends ItopDataTestCase { \$ormLinkset = \$oObject->Get('workorders_list'); \$ormLinkset->AddItem(MetaModel::NewObject('WorkOrder', [])); \$oObject->Set('workorders_list', \$ormLinkset); -PHP, +PHP + , false, true, ], @@ -88,7 +88,8 @@ PHP, \$ormLinkset = \$oObject->Get('contacts_list'); \$ormLinkset->AddItem(MetaModel::NewObject('lnkContactToTicket', [])); \$oObject->Set('contacts_list', \$ormLinkset); -PHP, +PHP + , false, true, ], @@ -97,7 +98,8 @@ PHP, 'value', <<Set('value', 100); -PHP, +PHP + , false, true, ], @@ -106,7 +108,8 @@ PHP, 'speed', <<Set('speed', 1024.5); -PHP, +PHP + , false, true, ], @@ -115,7 +118,8 @@ PHP, 'title', <<Set('title', 'Some title'); -PHP, +PHP + , false, true, ], @@ -124,7 +128,8 @@ PHP, 'item_id', <<Set('item_id', 12); -PHP, +PHP + , false, true, ], @@ -133,7 +138,8 @@ PHP, 'org_id', <<Set('org_id', 3); -PHP, +PHP + , false, true, ], @@ -142,7 +148,8 @@ PHP, 'file', <<Set('file', new ormDocument('something', 'text/plain', 'something.txt')); -PHP, +PHP + , false, true, ], @@ -167,7 +174,8 @@ PHP, /** @var \ormPassword \$ormPassword */ \$ormPassword = new ormPassword('somehash', 'somesalt'); \$oObject->Set('password', \$ormPassword); -PHP, +PHP + , false, true, ], From 34368fe795b6c7d54c15f292c01ac45219c63c04 Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Tue, 11 Apr 2023 17:52:41 +0200 Subject: [PATCH 2/2] =?UTF-8?q?N=C2=B06173=20\HTMLSanitizer::Sanitize=20:?= =?UTF-8?q?=20Fix=20handling=20only=20svg=5Fsanitizer=20(#450)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/htmlsanitizer.class.inc.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/htmlsanitizer.class.inc.php b/core/htmlsanitizer.class.inc.php index 18bb2574d..68cf63176 100644 --- a/core/htmlsanitizer.class.inc.php +++ b/core/htmlsanitizer.class.inc.php @@ -49,10 +49,9 @@ abstract class HTMLSanitizer $sSanitizerClass = 'HTMLDOMSanitizer'; } else if (false === is_subclass_of($sSanitizerClass, HTMLSanitizer::class)) { if ($sConfigKey === 'html_sanitizer') { - IssueLog::Warning('The configured "'.$sConfigKey.'" class "'.$sSanitizerClass.'" is not a subclass of HTMLSanitizer. Will use HTMLDOMSanitizer as the default sanitizer.'); + IssueLog::Warning('The configured "'.$sConfigKey.'" class "'.$sSanitizerClass.'" is not a subclass of '.HTMLSanitizer::class.'. Will use HTMLDOMSanitizer as the default sanitizer.'); $sSanitizerClass = 'HTMLDOMSanitizer'; - } - if ($sConfigKey === 'svg_sanitizer') { + } else { IssueLog::Error('The configured "'.$sConfigKey.'" class "'.$sSanitizerClass.'" is not a subclass of '.HTMLSanitizer::class.' ! Won\'t sanitize string.'); return $sHTML;