This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » eZ Publish 5 Platform » Missing form token

Missing form token

Missing form token

Tuesday 21 May 2013 11:11:32 am - 3 replies

Hi everybody!

I implemented a very simple symfony form for creating content objects.

Every time I submit the form I got an exception from Symfony saying "Missing form token from Request".

After some investigation, I found it might be related to csrf security problem. But from what I understood, this issue has been solved.

Is that normal? I use the community version 2013.4.

Maybe am I doing something wrong?

config.yml :

 csrf_protection: false

Here is the code used for the object creation :

        $repository = $this->getRepository();
        $contentService = $repository->getContentService();
        $contentTypeService = $repository->getContentTypeService();
        $locationService = $repository->getLocationService();
        $contentType = $contentTypeService->loadContentTypeByIdentifier('blog_post');
        $locationCreateStruct = $locationService->newLocationCreateStruct('2');
        $contentCreateStruct = $contentService->newContentCreateStruct( $contentType, 'fre-FR' );
        $contentCreateStruct->setField( 'title', $this->getRequest()->get('title') );
        $draft = $contentService->createContent( $contentCreateStruct, array( $locationCreateStruct ) );
        $content = $contentService->publishVersion( $draft->versionInfo );

And finally the form :

 <form method="post" action="http://ez5/create">
    <input type="text" value="Title" name="title">
    <input type="submit" value="OK">

Thank you for any advice.

Modified on Tuesday 21 May 2013 11:12:25 am by Julien Montavit

Wednesday 22 May 2013 8:28:34 am

I suggest you to use the symfony way for rendering the form :

Wednesday 22 May 2013 9:02:44 am

Thank you Bruno.

I didn't know that the problem could come from that! I'll try and post something here to say if it's working or not blunk.gif Emoticon

Thursday 23 May 2013 10:19:26 am

So, after using the Symfony way for rendering the form, the exception is gone!

Thank you again


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from