From 1db9c0441ce160b2e930f8fc8f4d02802e61a358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be> Date: Mon, 22 Oct 2018 10:17:35 +0200 Subject: [PATCH] :ambulance: fix(BooleanAttribute) Fix %askme% support and boolean in templates (TRUE == '%askme') evaluates to TRUE in PHP, we need to use === in this case issue #5897 --- .../simpleplugin/attributes/class_BooleanAttribute.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/simpleplugin/attributes/class_BooleanAttribute.inc b/include/simpleplugin/attributes/class_BooleanAttribute.inc index 69f258fcf..770ed6d66 100644 --- a/include/simpleplugin/attributes/class_BooleanAttribute.inc +++ b/include/simpleplugin/attributes/class_BooleanAttribute.inc @@ -58,7 +58,7 @@ class BooleanAttribute extends Attribute function inputValue ($value) { - if ($this->isTemplate() && $this->isTemplatable() && ($value == '%askme%')) { + if ($this->isTemplate() && $this->isTemplatable() && ($value === '%askme%')) { return $value; } return ($value == $this->trueValue); @@ -70,7 +70,7 @@ class BooleanAttribute extends Attribute if ($this->isTemplate() && $this->isTemplatable()) { if (!isset($_POST[$this->getHtmlId()])) { $this->setPostValue(FALSE); - } elseif ($_POST[$this->getHtmlId()] == '%askme%') { + } elseif ($_POST[$this->getHtmlId()] === '%askme%') { $this->setPostValue('%askme%'); } else { $this->setPostValue($_POST[$this->getHtmlId()] == 'TRUE'); @@ -83,7 +83,7 @@ class BooleanAttribute extends Attribute function computeLdapValue () { - if ($this->isTemplate() && $this->isTemplatable() && ($this->value == '%askme%')) { + if ($this->isTemplate() && $this->isTemplatable() && ($this->value === '%askme%')) { return $this->value; } else { return ($this->value ? $this->trueValue : $this->falseValue); @@ -109,7 +109,7 @@ class BooleanAttribute extends Attribute { if ($this->isTemplatable()) { $id = $this->getHtmlId(); - if ($this->getValue() == '%askme%') { + if ($this->getValue() === '%askme%') { $selected = '%askme%'; } elseif ($this->getValue()) { $selected = 'TRUE'; -- GitLab