Bug #77338 ยป patch_77338.diff
typo3/sysext/extbase/Classes/Validation/Validator/AbstractValidator.php | ||
---|---|---|
/**
|
||
* @var \TYPO3\CMS\Extbase\Error\Result
|
||
*/
|
||
protected $result;
|
||
protected $result = null;
|
||
/**
|
||
* Constructs the validator and sets validation options
|
typo3/sysext/extbase/Classes/Validation/Validator/GenericObjectValidator.php | ||
---|---|---|
protected $propertyValidators = [];
|
||
/**
|
||
* There is only one "GenericObjectValidator" instance per class. So a resultStack
|
||
* is necessary to allow checking of nested object structures which utilize the
|
||
* same class at different locations.
|
||
*
|
||
* @var array
|
||
*/
|
||
protected $resultStack = array();
|
||
/**
|
||
* Checks if the given value is valid according to the validator, and returns
|
||
* the Error Messages object which occurred.
|
||
*
|
||
... | ... | |
*/
|
||
public function validate($value)
|
||
{
|
||
$this->pushResult();
|
||
$this->result = new \TYPO3\CMS\Extbase\Error\Result();
|
||
if ($this->acceptsEmptyValues === false || $this->isEmpty($value) === false) {
|
||
if (!is_object($value)) {
|
||
... | ... | |
$this->isValid($value);
|
||
}
|
||
}
|
||
return $this->popResult();
|
||
}
|
||
return $this->result;
|
||
/**
|
||
* Pushes the existing $this->result variable onto a local stack.
|
||
*
|
||
* @return void
|
||
*/
|
||
protected function pushResult()
|
||
{
|
||
$this->resultStack[] = $this->result;
|
||
$this->result = new \TYPO3\CMS\Extbase\Error\Result();
|
||
}
|
||
/**
|
||
* Returns the current $this->result from within an intermediate temporary
|
||
* variable while restoring $this->result from the stack.
|
||
*
|
||
* @return \TYPO3\CMS\Extbase\Error\Result
|
||
*/
|
||
protected function popResult()
|
||
{
|
||
$returnResult = $this->result;
|
||
$this->result = array_pop($this->resultStack);
|
||
return $returnResult;
|
||
}
|
||
/**
|
||
* Load the property value to be used for validation.
|
||
*
|
||
* In case the object is a doctrine proxy, we need to load the real instance first.
|