Development

Changeset 24627

You must first sign up to be able to contribute.

Changeset 24627

Show
Ignore:
Timestamp:
12/01/09 01:13:00 (3 years ago)
Author:
FabianLange
Message:

[1.3, 1.4] reverted r24605 because it introduced a regression (reopens #7753, #7702)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/validator/sfValidatorDate.class.php

    r24624 r24627  
    6565  protected function doClean($value) 
    6666  { 
     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 
    6778    // convert array to date string 
    6879    if (is_array($value)) 
     
    7182    } 
    7283 
    73     // check date format 
    74     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      
    8484    // convert timestamp to date number format 
    8585    if (ctype_digit($value)) 
  • branches/1.4/lib/validator/sfValidatorDate.class.php

    r24624 r24627  
    6565  protected function doClean($value) 
    6666  { 
     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 
    6778    // convert array to date string 
    6879    if (is_array($value)) 
     
    7182    } 
    7283 
    73     // check date format 
    74     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      
    8484    // convert timestamp to date number format 
    8585    if (ctype_digit($value))