Bonjour,

Je suis en train de développer un site sous symfony 2 et j'ai encore assez de mal avec ce framework.

J'utilise le bundle FOSUser pour gérer mes utilisateurs.
J'utilise donc les routes prédéfinies pour changer le mot de passe (user/change/change-password)

Après soumission du formulaire, mon mot de passe est bien changé, mais cela me redirige vers la page /user/profile. Et là, j'obtiens une erreur.

ContextErrorException: Notice: Array to string conversion in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Component\Translation\Translator.php line 188
in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Component\Translation\Translator.php line 188
at ErrorHandler->handle('8', 'Array to string conversion', 'C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Component\Translation\Translator.php', '188', array('id' => array('Le mot de passe a été modifié'), 'parameters' => array(), 'domain' => 'FOSUserBundle', 'locale' => 'fr')) in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Component\Translation\Translator.php line 188
at Translator->trans(array('Le mot de passe a été modifié'), array(), 'FOSUserBundle', null) in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Bridge\Twig\Extension\TranslationExtension.php line 97
at TranslationExtension->trans(array('Le mot de passe a été modifié'), array(), 'FOSUserBundle') in C:\Dropbox\Web\www\MonSite\app\cache\dev\twig\a4\37\1a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18.php line 44
at __TwigTemplate_a4371a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18->block_body(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('fos_user_content' => array(object(__ TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4363
at Twig_Template->displayBlock('body', array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('body' => array(object( __TwigTemplate_a4371a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18), 'block_body'), 'fos_user_content' => array(object(__ TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\Dropbox\Web\www\MonSite\app\cache\dev\twig\82\3e\7c75b197573c43a5b509c4f73fe0e564567bbe9644e5f49035553fc71c1f.php line 191
at __TwigTemplate_823e7c75b197573c43a5b509c4f73fe0e564567bbe9644e5f49035553fc71c1f->doDisplay(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('body' => array(object(__ TwigTemplate_a4371a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18), 'block_body'), 'fos_user_content' => array(object(__TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4418
at Twig_Template->displayWithErrorHandling(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('body' => array(object( __TwigTemplate_a4371a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18), 'block_body'), 'fos_user_content' => array(object(__ TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4399
at Twig_Template->display(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('body' => array(object( __TwigTemplate_a4371a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18), 'block_body'), 'fos_user_content' => array(object(__ TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\Dropbox\Web\www\MonSite\app\cache\dev\twig\a4\37\1a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18.php line 25
at __TwigTemplate_a4371a889a83f1973b12b92d355762bb376caa79bc0172c15c8410cb28d97f18->doDisplay(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('fos_user_content' => array(object(__ TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4418
at Twig_Template->displayWithErrorHandling(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('fos_user_content' => array(object(__TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4399
at Twig_Template->display(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array('fos_user_content' => array(object(__TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f), 'block_fos_user_content'))) in C:\Dropbox\Web\www\MonSite\app\cache\dev\twig\64\c6\0ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f.php line 24
at __TwigTemplate_64c60ba703f7ed022efd30cd24d08c3f8f9f1d0e83c93bc43cb59ff29b10a36f->doDisplay(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array()) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4418
at Twig_Template->displayWithErrorHandling(array('user' => object(User), 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => true), 'app' => object(GlobalVariables)), array()) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4399
at Twig_Template->display(array('user' => object(User))) in C:\wamp\www\MonSite\app\cache\dev\classes.php line 4406
at Twig_Template->render(array('user' => object(User))) in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php line 53
at TwigEngine->render('FOSUserBundle:Profile:show.html.twig', array('user' => object(User))) in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 83
at TwigEngine->render('FOSUserBundle:Profile:show.html.twig', array('user' => object(User))) in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine.php line 52
at TimedTwigEngine->render('FOSUserBundle:Profile:show.html.twig', array('user' => object(User))) in C:\wamp\www\MonSite\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 112
at TwigEngine->renderResponse('FOSUserBundle:Profile:show.html.twig', array('user' => object(User))) in C:\wamp\www\MonSite\vendor\friendsofsymfony\user-bundle\FOS\UserBundle\Controller\ProfileController.php line 41
at ProfileController->showAction()
at call_user_func_array(array(object(ProfileController), 'showAction'), array()) in C:\wamp\www\MonSite\app\bootstrap.php.cache line 2841
at HttpKernel->handleRaw(object(Request), '1') in C:\wamp\www\MonSite\app\bootstrap.php.cache line 2815
at HttpKernel->handle(object(Request), '1', true) in C:\wamp\www\MonSite\app\bootstrap.php.cache line 2944
at ContainerAwareHttpKernel->handle(object(Request), '1', true) in C:\wamp\www\MonSite\app\bootstrap.php.cache line 2245
at Kernel->handle(object(Request)) in C:\wamp\www\MonSite\web\app_dev.php line 28

On voit donc ça dans la stack : 4L\vendor\symfony\symfony\src\Symfony\Component\Translation\Translator.php', '188', array('id' => a rray('Le mot de passe a été modifié') , 'parameters' => array(), 'domain' => 'FOSUserBundle', 'locale' => 'fr'))

Donc je pense que c'est une erreur d'accent mais je n'arrive pas à la regler.

Dans mon config.yml, j'ai bien la ligne default_locale: "%locale%"

Merci de votre aide !

Aucune réponse