#89971Extbase validation broken since merge of "58833: [BUGFIX] Keep existing validation errors for recursive domain relations"
Description
Change https://review.typo3.org/c/Packages/TYPO3.CMS/+/58833 breaks usage of extbase validation in at least TYPO3 8.7.
With PHP 7.0 I see weird effects for this code:
class MyAbstractModel extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {}
class MyModel extends MyAbstractModel {
/**
* @var int
* @validate \Vendor\Extension\Domain\Validator\NumberRangeNull (minimum = 0, maximum = 15)
*/
protected $myInteger;
}
$objectsData = [16,0];
foreach ($objectsData as $objectData) {
$myModel = $this->objectManager->get(Domain\Model\MyModel::class);
$myModel->setMyInteger($objectData);
$validator = $this->validatorResolver->getBaseValidatorConjunction(Domain\Model\MyModel::class);
$validatorResults = $validator->validate($object);
var_dump($myModel->getMyInteger()); # returns 16 for first $myModel and 0 for second $myModel
var_dump($validatorResults); # returns object(TYPO3\CMS\Extbase\Error\Result)#112081 for BOTH $myModel (!)
}
Running the code with change #58833 the $validatorResults for the second object contain exactly the SAME object(TYPO3\CMS\Extbase\Error\Result)#112081 stating that the second object is invalid while it is not.
If I revert change #58833 the code runs without issues.
With PHP 7.2 the effects are even worse (!):
During validation of a certain object the PHP CLI process executing eats up all RAM and dies:
32211 Killed /home/mysite/www/typo3/sysext/core/bin/typo3 $@
syslog:
winbindd invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0 [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name [32211] 0 32211 3154075 1901446 6144 795905 0 php Out of memory: Kill process 32211 (php) score 633 or sacrifice child Killed process 32211 (php) total-vm:12616300kB, anon-rss:7605736kB, file-rss:48kB