Open pirasterize opened 9 years ago
$this->form->isSubmitted()
will always be false before the ->bind()
call, so it is weird if it changes something here. something weird must be going on.
and the weird thing is that there is no call to form->setData
on line 46 of the RegistrationFormHandler in 1.3.x. Which version of FOSUserBundle are you using ?
could you please give the full stack trace of exceptions instead of just an extract of the beginning ? this would help debugging. Recent versions of Symfony are providing a plain-text rendering of the stack trace at the bottom of the exception page btw.
Thanx for answer I'll try to give all possible info The version from composer.lock is :
"name": "friendsofsymfony/user-bundle",
"version": "v1.3.6",
"target-dir": "FOS/UserBundle",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git",
"reference": "2022ac8463a8c50dd631f93a17064bd41795fff2"
},
The line is 44th (was 46 because of my test) here is the stack :
[1/2] AlreadySubmittedException: You cannot change the data of a submitted form. -
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 314 - // changed. In such cases (i.e. when the form is not initialized yet) don't // abort this method. if ($this->submitted && $this->defaultDataSet) { throw new AlreadySubmittedException('You cannot change the data of a submitted form.'); } // If the form inherits its parent's data, disallow data setting to at Form ->setData (object(User)) in vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Form/Handler/RegistrationFormHandler.php at line 44 - public function process($confirmation = false) { $user = $this->createUser(); $this->form->setData($user); if ('POST' === $this->request->getMethod()) { $this->form->bind($this->request); at RegistrationFormHandler ->process (false) in vendor/sonata-project/user-bundle/Controller/RegistrationFOSUser1Controller.php at line 48 + at RegistrationFOSUser1Controller ->registerAction () at call_user_func_array (array(object(RegistrationFOSUser1Controller), 'registerAction'), array()) in app/bootstrap.php.cache at line 3094 + at HttpKernel ->handleRaw (object(SiteRequest), '2') in app/bootstrap.php.cache at line 3056 + at HttpKernel ->handle (object(SiteRequest), '2', false) in app/bootstrap.php.cache at line 3207 + at ContainerAwareHttpKernel ->handle (object(SiteRequest), '2', false) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php at line 85 + at InlineFragmentRenderer ->render (object(ControllerReference), object(SiteRequest), array('ignore_errors' => false)) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Fragment/FragmentHandler.php at line 118 + at FragmentHandler ->render (object(ControllerReference), 'inline', array()) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/LazyLoadingFragmentHandler.php at line 56 + at LazyLoadingFragmentHandler ->render (object(ControllerReference), 'inline', array()) in vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php at line 64 + at ActionsExtension ->renderUri (object(ControllerReference), array()) in app/cache/dev/twig/4/1/410827eec24cd06b80fc0f0d925afe8584d4b954d1ec23ee8688c03134f0acac.php at line 213 +
a more clear stack with image (I couldn't paste correctly) :
The error I got is : An exception has been thrown during the rendering of a template ("You cannot change the data of a submitted form.") in SonataUserBundle:Security:base_login.html.twig at line 86.
basically is something about validation. I tried to find something similar in others issues but didn't find nothing. I m writing this post for people having same problem and for developers to offer further informations.
I run a "composer update" yesterday and now i m running with 2.7.1 of symfony here is my require section of composer.json :
I found a temporarely solution editing/overwriting the FOSUserBundle RegistrationFormHandler the process function :
That's all