As the \Zend\Validator\AbstractValidator::createMessage method uses var_export to convert arrays to strings this fails if the array contains a circular reference. The problem line is https://github.com/zendframework/zend-validator/blob/master/src/AbstractValidator.php#L294.
I've provided a quick example of this below which outputs "PHP Warning: var_export does not handle circular references":
class ExampleValidator extends \Zend\Validator\AbstractValidator
{
protected $messageTemplates = [
'someError' => 'error'
];
public function isValid($value)
{
$this->setValue($value);
$this->error('someError');
return false;
}
}
class Circular {
public $reference;
}
$test = new Circular();
$test->reference = $test;
$validator = new ExampleValidator();
$validator->isValid([$test]);
Originally posted by @tomp4l at zendframework/zend-validator#82
As the
\Zend\Validator\AbstractValidator::createMessagemethod usesvar_exportto convert arrays to strings this fails if the array contains a circular reference. The problem line is https://github.com/zendframework/zend-validator/blob/master/src/AbstractValidator.php#L294.I've provided a quick example of this below which outputs "PHP Warning: var_export does not handle circular references":
Originally posted by @tomp4l at zendframework/zend-validator#82