derick          Tue Jul 15 17:38:42 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/date/lib       dow.c parse_date.c parse_date.re timelib.h 
  Log:
  - MFH: Also add the warnings for times. This does not make sense for the
    english text parser, as invalid times are never allowed in there.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/dow.c?r1=1.8.2.3.2.3.2.3&r2=1.8.2.3.2.3.2.4&diff_format=u
Index: php-src/ext/date/lib/dow.c
diff -u php-src/ext/date/lib/dow.c:1.8.2.3.2.3.2.3 
php-src/ext/date/lib/dow.c:1.8.2.3.2.3.2.4
--- php-src/ext/date/lib/dow.c:1.8.2.3.2.3.2.3  Mon Jul 14 17:35:52 2008
+++ php-src/ext/date/lib/dow.c  Tue Jul 15 17:38:07 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dow.c,v 1.8.2.3.2.3.2.3 2008/07/14 17:35:52 derick Exp $ */
+/* $Id: dow.c,v 1.8.2.3.2.3.2.4 2008/07/15 17:38:07 derick Exp $ */
 
 #include "timelib.h"
 
@@ -140,6 +140,14 @@
        return day + ((w - 1) * 7) + d;
 }
 
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s)
+{
+       if (h < 0 || h > 23 || i < 0 || i > 59 || s < 0 || s > 59) {
+               return 0;
+       }
+       return 1;
+}
+
 int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d)
 {
        if (m < 1 || m > 12 || d < 1 || d > timelib_days_in_month(y, m)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.29.2.30.2.14.2.20&r2=1.29.2.30.2.14.2.21&diff_format=u
Index: php-src/ext/date/lib/parse_date.c
diff -u php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.20 
php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.21
--- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.20       Mon Jul 14 
17:35:52 2008
+++ php-src/ext/date/lib/parse_date.c   Tue Jul 15 17:38:07 2008
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.13.5 on Mon Jul 14 19:34:39 2008 */
+/* Generated by re2c 0.13.5 on Tue Jul 15 19:21:36 2008 */
 #line 1 "ext/date/lib/parse_date.re"
 /*
    +----------------------------------------------------------------------+
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_date.c,v 1.29.2.30.2.14.2.20 2008/07/14 17:35:52 derick Exp $ */
+/* $Id: parse_date.c,v 1.29.2.30.2.14.2.21 2008/07/15 17:38:07 derick Exp $ */
 
 #include "timelib.h"
 
@@ -23630,6 +23630,12 @@
                }
        }
 
+       /* do funky checking whether the parsed time was valid time */
+       if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
+               s->time->s != TIMELIB_UNSET && 
+               !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
+               add_pbf_warning(s, "The parsed time was invalid", string, ptr);
+       }
        /* do funky checking whether the parsed date was valid date */
        if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
                s->time->d != TIMELIB_UNSET && 
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.26.2.27.2.12.2.18&r2=1.26.2.27.2.12.2.19&diff_format=u
Index: php-src/ext/date/lib/parse_date.re
diff -u php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.18 
php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.19
--- php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.18      Mon Jul 14 
17:36:12 2008
+++ php-src/ext/date/lib/parse_date.re  Tue Jul 15 17:38:27 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: parse_date.re,v 1.26.2.27.2.12.2.18 2008/07/14 17:36:12 derick Exp $ */
+/* $Id: parse_date.re,v 1.26.2.27.2.12.2.19 2008/07/15 17:38:27 derick Exp $ */
 
 #include "timelib.h"
 
@@ -2040,6 +2040,12 @@
                }
        }
 
+       /* do funky checking whether the parsed time was valid time */
+       if (s->time->h != TIMELIB_UNSET && s->time->i != TIMELIB_UNSET &&
+               s->time->s != TIMELIB_UNSET && 
+               !timelib_valid_time( s->time->h, s->time->i, s->time->s)) {
+               add_pbf_warning(s, "The parsed time was invalid", string, ptr);
+       }
        /* do funky checking whether the parsed date was valid date */
        if (s->time->y != TIMELIB_UNSET && s->time->m != TIMELIB_UNSET &&
                s->time->d != TIMELIB_UNSET && 
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/timelib.h?r1=1.10.2.11.2.3.2.7&r2=1.10.2.11.2.3.2.8&diff_format=u
Index: php-src/ext/date/lib/timelib.h
diff -u php-src/ext/date/lib/timelib.h:1.10.2.11.2.3.2.7 
php-src/ext/date/lib/timelib.h:1.10.2.11.2.3.2.8
--- php-src/ext/date/lib/timelib.h:1.10.2.11.2.3.2.7    Mon Jul 14 17:36:12 2008
+++ php-src/ext/date/lib/timelib.h      Tue Jul 15 17:38:27 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: timelib.h,v 1.10.2.11.2.3.2.7 2008/07/14 17:36:12 derick Exp $ */
+/* $Id: timelib.h,v 1.10.2.11.2.3.2.8 2008/07/15 17:38:27 derick Exp $ */
 
 #ifndef __TIMELIB_H__
 #define __TIMELIB_H__
@@ -56,6 +56,7 @@
 timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, 
timelib_sll d);
 timelib_sll timelib_days_in_month(timelib_sll y, timelib_sll m);
 void timelib_isoweek_from_date(timelib_sll y, timelib_sll m, timelib_sll d, 
timelib_sll *iw, timelib_sll *iy);
+int timelib_valid_time(timelib_sll h, timelib_sll i, timelib_sll s);
 int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d);
 
 /* From parse_date.re */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to