From 8962c0c3e89cb4a62dd8a787d34689f87531cd10 Mon Sep 17 00:00:00 2001 From: Florian Hoss Date: Fri, 19 Jan 2024 17:51:47 +0100 Subject: [PATCH] Fix construction of sfValidatorError with an array of an array So in error messages the use of %year% %month% and %day% becomes possible --- lib/validator/sfValidatorDate.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/validator/sfValidatorDate.class.php b/lib/validator/sfValidatorDate.class.php index e685464c5..0f4d75854 100644 --- a/lib/validator/sfValidatorDate.class.php +++ b/lib/validator/sfValidatorDate.class.php @@ -154,7 +154,7 @@ protected function convertDateArrayToString($value) // all elements must be empty or a number foreach (array('year', 'month', 'day', 'hour', 'minute', 'second') as $key) { if (isset($value[$key]) && !ctype_digit((string) $value[$key]) && !empty($value[$key])) { - throw new sfValidatorError($this, 'invalid', array('value' => $value)); + throw new sfValidatorError($this, 'invalid', $value); } } @@ -164,14 +164,14 @@ protected function convertDateArrayToString($value) (!isset($value['month']) || !$value['month'] ? 1 : 0) + (!isset($value['day']) || !$value['day'] ? 1 : 0); if ($empties > 0 && $empties < 3) { - throw new sfValidatorError($this, 'invalid', array('value' => $value)); + throw new sfValidatorError($this, 'invalid', $value); } if (3 == $empties) { return $this->getEmptyValue(); } if (!checkdate((int) $value['month'], (int) $value['day'], (int) $value['year'])) { - throw new sfValidatorError($this, 'invalid', array('value' => $value)); + throw new sfValidatorError($this, 'invalid', $value); } if ($this->getOption('with_time')) { @@ -181,7 +181,7 @@ protected function convertDateArrayToString($value) $this->isValueSet($value, 'second') && (!$this->isValueSet($value, 'minute') || !$this->isValueSet($value, 'hour')) || $this->isValueSet($value, 'minute') && !$this->isValueSet($value, 'hour') ) { - throw new sfValidatorError($this, 'invalid', array('value' => $value)); + throw new sfValidatorError($this, 'invalid', $value); } $clean = sprintf(