From b55cee2934d88c75fa2c18404c0879a670c9fe8c Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 20 Apr 2023 16:40:06 -0400 Subject: [PATCH] Do not fill in missing booleans in configurations --- lib/AbstractSanitizer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/AbstractSanitizer.php b/lib/AbstractSanitizer.php index 711f4d3..b8b51f2 100644 --- a/lib/AbstractSanitizer.php +++ b/lib/AbstractSanitizer.php @@ -532,7 +532,9 @@ abstract class AbstractSanitizer { } // finally handle the boolean options foreach (["allowCustomElements", "allowUnknownMarkup", "allowComments", "allowProcessingInstructions", "nullNamespaceAsHtml"] as $opt) { - $out[$opt] = (bool) $config[$opt] ?? self::DEFAULT_CONF[$opt]; + if (isset($config[$opt])) { + $out[$opt] = (bool) $config[$opt]; + } } // use the normalized configuration $this->config = $out; @@ -600,7 +602,9 @@ abstract class AbstractSanitizer { } // finally handle the boolean options foreach (["allowCustomElements", "allowUnknownMarkup", "allowComments", "allowProcessingInstructions", "nullNamespaceAsHtml"] as $opt) { - $out[$opt] = $config[$opt]; + if (isset($config[$opt])) { + $out[$opt] = $config[$opt]; + } } // return the transformed configuration return $out;