Changeset 9535
- Timestamp:
- 06/11/08 10:51:26 (2 years ago)
- Author:
- fabien
- Message:
fixed sfValidatorDate Validation of Minutes '00'
fails (closes #3729)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/validator/sfValidatorDate.class.php
r9456 r9535 129 129 // but second can be empty 130 130 $empties = 131 (!isset($value['hour']) || !$value['hour']? 1 : 0) +132 (!isset($value['minute']) || !$value['minute']? 1 : 0) +133 (!isset($value['second']) || !$value['second']? 1 : 0)131 (!isset($value['hour']) || in_array($value['hour'], array(null, ''), true) ? 1 : 0) + 132 (!isset($value['minute']) || in_array($value['minute'], array(null, ''), true) ? 1 : 0) + 133 (!isset($value['second']) || in_array($value['second'], array(null, ''), true) ? 1 : 0) 134 134 ; 135 135 if ($empties > 0 && $empties < 3) 136 136 { 137 if (1 == $empties && (!isset($value['second']) || empty($value['second'])))137 if (1 == $empties && (!isset($value['second']) || in_array($value['second'], array(null, '')))) 138 138 { 139 139 // OK branches/1.1/test/unit/validator/sfValidatorDateTest.php
r9456 r9535 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test( 38, new lime_output_color());13 $t = new lime_test(40, new lime_output_color()); 14 14 15 15 $v = new sfValidatorDate(); … … 124 124 $t->is($v->clean(array('year' => 2005, 'month' => 10, 'day' => 15, 'hour' => 12, 'minute' => 10, 'second' => '')), '2005-10-15 12:10:00', '->clean() accepts an array as an input'); 125 125 $t->is($v->clean(array('year' => 2005, 'month' => 10, 'day' => 15, 'hour' => 12, 'minute' => 10)), '2005-10-15 12:10:00', '->clean() accepts an array as an input'); 126 $t->is($v->clean(array('year' => 2005, 'month' => 10, 'day' => 15, 'hour' => 0, 'minute' => 10)), '2005-10-15 00:10:00', '->clean() accepts an array as an input'); 127 $t->is($v->clean(array('year' => 2005, 'month' => 10, 'day' => 15, 'hour' => '0', 'minute' => 10)), '2005-10-15 00:10:00', '->clean() accepts an array as an input'); 126 128 try 127 129 {
Download in other formats:
Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.
