-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Potential BugPotential bugs or bugfixes, that needs to be reproduced.Potential bugs or bugfixes, that needs to be reproduced.
Description
I have many errors like this one in the latest master on PHP 7 :
[2016-12-02 12:58:33] php.CRITICAL: Uncaught Exception: Serialization of 'Closure' is not allowed {"exception":"[object] (Exception(code: 0): Serialization of 'Closure' is not allowed at /vendor/zendframework/zend-stdlib/src/PriorityQueue.php:178)"} []
and no stack trace to try to find the error (the debugger does not load) :/
I have looked around what could be the problem and I found that the Form component might not like function closures for choices
. Sonata reportedly had the same problem and they fixed it here (See related discussion here).
Not sure if the problem is in Sylius directly but it could be in code like this one :
public function configureOptions(OptionsResolver $resolver)
{
$resolver
->setDefaults([
'choices' => function (Options $options) {
if (null === $options['enabled']) {
return $this->countryRepository->findAll();
}
return $this->countryRepository->findBy(['enabled' => $options['enabled']]);
},
'choice_value' => 'code',
'choice_label' => 'name',
'choice_translation_domain' => false,
'enabled' => true,
'label' => 'sylius.form.address.country',
'placeholder' => 'sylius.form.country.select',
])
;
}
(see for instance
'choices' => function (Options $options) { |
Anybody encountered the same error ?
Thanks
Metadata
Metadata
Assignees
Labels
Potential BugPotential bugs or bugfixes, that needs to be reproduced.Potential bugs or bugfixes, that needs to be reproduced.