Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/form/sfForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ class sfForm implements ArrayAccess, Iterator, Countable
*/
public function __construct($defaults = array(), $options = array(), $CSRFSecret = null)
{
$this->validatorSchema = new sfValidatorSchema();

Comment on lines +66 to +67
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit unclear from the description (why it is needed)

Copy link
Author

@terdia terdia May 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$this->validatorSchema was used in line 947 before it was initialized, this code $this->validatorSchema[self::$CSRFFieldName] tries to access a key in validatorSchema the usage is triggered by $this->setDefaults($defaults) which calls the function $this->isCSRFProtected() this resulted in an exception trying to access array offset on value of type null

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2021-05-18 at 10 29 56

$this->setDefaults($defaults);
$this->options = $options;
$this->localCSRFSecret = $CSRFSecret;

$this->validatorSchema = new sfValidatorSchema();
$this->widgetSchema = new sfWidgetFormSchema();
$this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

Expand Down
Loading