cvs: pear /Validate Validate.php package.xml /Validate/tests bug8851.phpt
| From: | Amir Mohammad Saied | Date: | Thu, 05 Oct 2006 04:29:21 +0000 |
| Subject: | cvs: pear /Validate Validate.php package.xml /Validate/tests bug8851.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-42417@lists.php.net to get a copy of this message | ||
amir Thu Oct 5 04:29:21 2006 UTC
Added files:
/pear/Validate/tests bug8851.phpt
Modified files:
/pear/Validate Validate.php package.xml
Log:
Fixing #8851, letters in time
http://cvs.php.net/viewvc.cgi/pear/Validate/Validate.php?r1=1.96&r2=1.97&diff_format=u
Index: pear/Validate/Validate.php
diff -u pear/Validate/Validate.php:1.96 pear/Validate/Validate.php:1.97
--- pear/Validate/Validate.php:1.96 Wed Sep 20 17:41:05 2006
+++ pear/Validate/Validate.php Thu Oct 5 04:29:21 2006
@@ -32,7 +32,7 @@
* @author Pierre-Alain Joye <pajoye@php.net>
* @copyright 1997-2005 Pierre-Alain Joye,Tomas V.V.Cox
* @license http://www.opensource.org/licenses/bsd-license.php
New BSD License
- * @version CVS: $Id: Validate.php,v 1.96 2006/09/20 17:41:05 amir Exp $
+ * @version CVS: $Id: Validate.php,v 1.97 2006/10/05 04:29:21 amir Exp $
* @link http://pear.php.net/package/Validate
*/
@@ -496,7 +496,7 @@
} else {
$hour = Validate::_substr($date, 2);
}
- if ($hour < 0 || $hour > 12) {
+ if (!is_int($hour) || $hour < 0 || $hour > 12) {
return false;
}
break;
@@ -507,14 +507,14 @@
} else {
$hour = Validate::_substr($date, 2);
}
- if ($hour < 0 || $hour > 24) {
+ if (!is_int($hour) || $hour < 0 || $hour > 24) {
return false;
}
break;
case 's':
case 'i':
$t = Validate::_substr($date, 2);
- if ($t < 0 || $t > 59) {
+ if (!is_int($t) || $t < 0 || $t > 59) {
return false;
}
break;
http://cvs.php.net/viewvc.cgi/pear/Validate/package.xml?r1=1.71&r2=1.72&diff_format=u
Index: pear/Validate/package.xml
diff -u pear/Validate/package.xml:1.71 pear/Validate/package.xml:1.72
--- pear/Validate/package.xml:1.71 Wed Sep 20 17:41:05 2006
+++ pear/Validate/package.xml Thu Oct 5 04:29:21 2006
@@ -54,6 +54,8 @@
* #8442, Preventing a Notice
- email():
* #8629, hostnames starting with numbers are valid because of their popularity
+- date():
+ * #8851, date-validation doesn't allow letters in time.
</notes>
<filelist>
<dir name="/">
http://cvs.php.net/viewvc.cgi/pear/Validate/tests/bug8851.phpt?view=markup&rev=1.1
Index: pear/Validate/tests/bug8851.phpt
+++ pear/Validate/tests/bug8851.phpt
--TEST--
#8851, validate::date: date-validation allows letters in time.
--FILE--
<?php
require_once 'Validate.php';
$validate = & new Validate();
$time = "aa:aa";
if (!$validate->date($time,array("format"=>"%h:%i"))) {
echo "Ok";
}
?>
--EXPECT--
Ok