diff --git a/core/lib/Drupal/Core/Render/Element/Radio.php b/core/lib/Drupal/Core/Render/Element/Radio.php index 643007b..826431f 100644 --- a/core/lib/Drupal/Core/Render/Element/Radio.php +++ b/core/lib/Drupal/Core/Render/Element/Radio.php @@ -42,15 +42,15 @@ public function getInfo() { * typed. * * @param mixed $value - * A bool value which would be casted to string. + * A value which would be casted. * - * @return string - * The casted value of the bool value. + * @return mixed + * The casted value of the parameter. */ protected static function castValue($value) { - if (filter_var($value, FILTER_VALIDATE_BOOLEAN)) { - return (string) (int) $value; + if (is_bool($value) || (int) (bool) $value === (int) $value) { + return (string) (int) $value; } return $value; }