From c5778b0744ab3f6bc26a9d5918145b4f260709a4 Mon Sep 17 00:00:00 2001 From: Ivo Azirjans Date: Thu, 14 Jan 2016 14:04:18 +0200 Subject: [PATCH] [Form] fixed false value being converted to an empty string in ChoiceArrayList When `false` value is used as a choice value, it is converted to an empty string, which conflicts with the empty value, if the choice is optional. If the choice is not optional, then there may be problems with html validation, since required choice does not allow empty value to be submitted. This patch disables value casting to string, when the choice contains values, that would be converted to an empty string. --- src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php index b1e6b3bf06b5c..6b0c8f5c65062 100644 --- a/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php +++ b/src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php @@ -233,7 +233,7 @@ private function castableToString(array $choices, array &$cache = array()) } continue; - } elseif (!is_scalar($choice)) { + } elseif (!is_scalar($choice) || false === $choice) { return false; } elseif (isset($cache[(string) $choice])) { return false; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy