Explorar o código

Fix the incorrect handling of boolean types (#4369)

Marco Polichetti %!s(int64=8) %!d(string=hai) anos
pai
achega
3780cc269e
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      Controller/HelperController.php

+ 5 - 0
Controller/HelperController.php

@@ -285,6 +285,11 @@ class HelperController
             $value = new \DateTime($value);
         }
 
+        // Handle boolean type transforming the value into a boolean
+        if ('' !== $value && $fieldDescription->getType() == 'boolean') {
+            $value = filter_var($value, FILTER_VALIDATE_BOOLEAN);
+        }
+
         $this->pool->getPropertyAccessor()->setValue($object, $propertyPath, '' !== $value ? $value : null);
 
         $violations = $this->validator->validate($object);