Changeset 24627
- Timestamp:
- 12/01/09 01:13:00 (3 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.3/lib/validator/sfValidatorDate.class.php
r24624 r24627 65 65 protected function doClean($value) 66 66 { 67 // check date format 68 if ($regex = $this->getOption('date_format')) 69 { 70 if (!preg_match($regex, $value, $match)) 71 { 72 throw new sfValidatorError($this, 'bad_format', array('value' => $value, 'date_format' => $this->getOption('date_format_error') ? $this->getOption('date_format_error') : $this->getOption('date_format'))); 73 } 74 75 $value = $match; 76 } 77 67 78 // convert array to date string 68 79 if (is_array($value)) … … 71 82 } 72 83 73 // check date format74 if ($regex = $this->getOption('date_format'))75 {76 if (!preg_match($regex, $value, $match))77 {78 throw new sfValidatorError($this, 'bad_format', array('value' => $value, 'date_format' => $this->getOption('date_format_error') ? $this->getOption('date_format_error') : $this->getOption('date_format')));79 }80 81 $value = $match;82 }83 84 84 // convert timestamp to date number format 85 85 if (ctype_digit($value)) branches/1.4/lib/validator/sfValidatorDate.class.php
r24624 r24627 65 65 protected function doClean($value) 66 66 { 67 // check date format 68 if ($regex = $this->getOption('date_format')) 69 { 70 if (!preg_match($regex, $value, $match)) 71 { 72 throw new sfValidatorError($this, 'bad_format', array('value' => $value, 'date_format' => $this->getOption('date_format_error') ? $this->getOption('date_format_error') : $this->getOption('date_format'))); 73 } 74 75 $value = $match; 76 } 77 67 78 // convert array to date string 68 79 if (is_array($value)) … … 71 82 } 72 83 73 // check date format74 if ($regex = $this->getOption('date_format'))75 {76 if (!preg_match($regex, $value, $match))77 {78 throw new sfValidatorError($this, 'bad_format', array('value' => $value, 'date_format' => $this->getOption('date_format_error') ? $this->getOption('date_format_error') : $this->getOption('date_format')));79 }80 81 $value = $match;82 }83 84 84 // convert timestamp to date number format 85 85 if (ctype_digit($value))