Development

#9928 (CSRF Token not generate in case of post size exceed.)

You must first sign up to be able to contribute.

Ticket #9928 (new defect)

Opened 2 years ago

CSRF Token not generate in case of post size exceed.

Reported by: dinesh.tekmindz Assigned to: fabien
Priority: major Milestone:
Component: form Version: 1.4.10
Keywords: CSRF TOKEN Cc:
Qualification: Unreviewed

Description

Hi symfony team,

I has faced a problem in symfony 1.4.* . When i am posting a form that exceed the max post size (define in php.ini).I have max post size in php.ini is 1 MB and i am posting 1.5 MB data, Symfony gives me error " Error :: The form submission cannot be processed. It probably means that you have uploaded a file that is too big."

Here all things are right but when symfony gives post_max_size error then form does not generate value of CSRF TOKEN.

Again when i post less then post_max_size (php.ini) data from form. Then it gives me CSRF TOKEN Required Error.

Below is the example code.To generate error you have to create these 3 files.

1 - actions.class.php

class fileUploadActions extends sfActions {

public function executeIndex(sfWebRequest $request) {

$this->form = new CustomFileForm?();

if ($request->getPostParameters()) {

$this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) {

}

}

}

}

2- Create a indexSucess.php Files

class fileUploadActions extends sfActions {

public function executeIndex(sfWebRequest $request) {

$this->form = new CustomFileForm?();

if ($request->getPostParameters()) {

$this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) {

}

}

}

}

3 - CustomFileForm?.class.php

class fileUploadActions extends sfActions {

public function executeIndex(sfWebRequest $request) {

$this->form = new CustomFileForm?();

if ($request->getPostParameters()) {

$this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName())); if ($this->form->isValid()) {

}

}

}

}