Skip to content

Commit

Permalink
Fixes to form validation process
Browse files Browse the repository at this point in the history
Fixes hardening measure introduced in #23716
  • Loading branch information
wilsonge committed Dec 22, 2023
1 parent 3265efa commit c246730
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libraries/src/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ protected function bindLevel($group, $data)
}

/**
* Return all errors, if any.
* Return Exceptions thrown during the form validation process.
*
* @return \Exception[] Array of error messages or RuntimeException objects.
* @return \Exception[]
*
* @since 1.7.0
*/
Expand Down Expand Up @@ -1055,8 +1055,8 @@ public function filter($data, $group = null)
/**
* Method to validate form data.
*
* Validation warnings will be pushed into JForm::errors and should be
* retrieved with JForm::getErrors() when validate returns boolean false.
* Validation warnings will be pushed into Form::$errors and should be
* retrieved with Form::getErrors() when validate returns boolean false.
*
* @param array $data An array of field values to validate.
* @param string $group The optional dot-separated form group path on which to filter the
Expand Down Expand Up @@ -1134,6 +1134,7 @@ public function validate($data, $group = null)
// The field returned false from setup and shouldn't be included in the page body - yet we received
// a value for it. This is probably some sort of injection attack and should be rejected
$this->errors[] = new \RuntimeException(Text::sprintf('JLIB_FORM_VALIDATE_FIELD_INVALID', $key));
$return = false;
}
}

Expand Down

0 comments on commit c246730

Please sign in to comment.