potential PEAR::Validate bug (in date method)

From: Date: Thu, 22 Jan 2004 13:00:06 +0000
Subject: potential PEAR::Validate bug (in date method)
Groups: php.pear.dev php.pear.general 
Request: Send a blank email to pear-dev+get-25225@lists.php.net to get a copy of this message
Hi, I also may have found a bug. please tell me if I should report this bug (if is is one) and if or how to $aTime = "DF:df"; $isTime = Validate::date( $aTime, array( 'format'=>"%H:%i") ); this passes; a possible fix thx change the date method from line 269 ========================= case 'g': case 'h': if ($next == 'g') { $hour = Validate::_substr($date, 1, 2); } else { $hour = Validate::_substr($date, 2); } if ($hour < 0 || $hour > 12) { return false; } break; case 'G': case 'H': if ($next == 'G') { $hour = Validate::_substr($date, 1, 2); } else { $hour = Validate::_substr($date, 2); } if ($hour < 0 || $hour > 24) { return false; } break; case 's': case 'i': $t = Validate::_substr($date, 2); if ($t < 0 || $t > 59) { return false; } break; ========================= into ========================= case 'g': case 'h': if ($next == 'g') { $hour = Validate::_substr($date, 1, 2); } else { $hour = Validate::_substr($date, 2); } if (!Validate::number($hour, array('decimal'=>false, 'min'=>0, 'max'=>12))) { return false; } break; case 'G': case 'H': if ($next == 'G') { $hour = Validate::_substr($date, 1, 2); } else { $hour = Validate::_substr($date, 2); } if (!Validate::number($hour, array('decimal'=>false, 'min'=>0, 'max'=>23))) { return false; } break; case 's': case 'i': $t = Validate::_substr($date, 2); if (!Validate::number($t, array('decimal'=>false, 'min'=>0, 'max'=>59))) { return false; } break; =========================

« previous php.pear.dev (#25225) next »