File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -408,8 +408,10 @@ public static function datetime(
408408 return false ;
409409 }
410410 $ lastErrors = \DateTime::getLastErrors ();
411- return $ lastErrors
412- && $ lastErrors ['warning_count ' ] === 0
411+ if ($ lastErrors === false ) {
412+ return true ;
413+ }
414+ return $ lastErrors ['warning_count ' ] === 0
413415 && $ lastErrors ['error_count ' ] === 0 ;
414416 }
415417
Original file line number Diff line number Diff line change @@ -176,6 +176,9 @@ public function testDatetime() : void
176176 self ::assertTrue (Validator::datetime ('year ' , $ this ->array , 'Y ' ));
177177 self ::assertFalse (Validator::datetime ('alpha ' , $ this ->array ));
178178 self ::assertFalse (Validator::datetime ('unknown ' , $ this ->array ));
179+ self ::assertFalse (Validator::datetime ('foo ' , [
180+ 'foo ' => '2022-02-29 25:10:10 ' ,
181+ ]));
179182 }
180183
181184 public function testEquals () : void
You can’t perform that action at this time.
0 commit comments