Fixed bug in ChoiceType triggering a warning when not using utf-8

This fixes issue #10409 by not using json_encode anymore, but serialize
instead.
This commit is contained in:
Koen Kuipers 2014-03-27 13:42:59 +01:00 committed by Fabien Potencier
parent f4ffd95713
commit 73d56f7a1a

View File

@ -166,7 +166,7 @@ class ChoiceType extends AbstractType
$choices = null !== $options['choices'] ? $options['choices'] : array();
// Reuse existing choice lists in order to increase performance
$hash = md5(json_encode(array($choices, $options['preferred_choices'])));
$hash = hash('sha256', serialize(array($choices, $options['preferred_choices'])));
if (!isset($choiceListCache[$hash])) {
$choiceListCache[$hash] = new SimpleChoiceList($choices, $options['preferred_choices']);