derick          Thu Apr  1 15:35:41 2004 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/standard/tests/time    bug27780.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       parsedate.y 
  Log:
  - Fixed bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.624&r2=1.1247.2.625&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.624 php-src/NEWS:1.1247.2.625
--- php-src/NEWS:1.1247.2.624   Thu Apr  1 14:07:01 2004
+++ php-src/NEWS        Thu Apr  1 15:35:40 2004
@@ -8,6 +8,7 @@
 - Fixed bug #27809 (ftp_systype returns null on some ftp servers). (Ilia)
 - Fixed bug #27802 (default number of children to 8 when PHP_FCGI_CHILDREN is
   not defined). (Ilia)
+- Fixed bug #27780 (strtotime(+1 xxx) returns a wrong date/time). (Derick)
 - Fixed bug #27764 (Get return value from a stored procedure not returning any
   result sets). (Frank)
 - Fixed bug #27762 (SCO Openserver doesn't have S_ISSOCK). (Wez)
http://cvs.php.net/diff.php/php-src/ext/standard/parsedate.y?r1=1.34.2.5&r2=1.34.2.6&ty=u
Index: php-src/ext/standard/parsedate.y
diff -u php-src/ext/standard/parsedate.y:1.34.2.5 
php-src/ext/standard/parsedate.y:1.34.2.6
--- php-src/ext/standard/parsedate.y:1.34.2.5   Wed Dec 10 09:09:42 2003
+++ php-src/ext/standard/parsedate.y    Thu Apr  1 15:35:41 2004
@@ -8,7 +8,7 @@
 **  This code is in the public domain and has no copyright.
 */
 
-/* $Id: parsedate.y,v 1.34.2.5 2003/12/10 14:09:42 sniper Exp $ */
+/* $Id: parsedate.y,v 1.34.2.6 2004/04/01 20:35:41 derick Exp $ */
 
 #include "php.h"
 
@@ -150,8 +150,8 @@
 
 %}
 
-/* This grammar has 14 shift/reduce conflicts. */
-%expect 14
+/* This grammar has 40 shift/reduce conflicts. */
+%expect 40
 %pure_parser
 
 %token tAGO tDAY tDAY_UNIT tDAYZONE tDST tHOUR_UNIT tID
@@ -192,12 +192,26 @@
            ((struct date_yy *)parm)->yyMinutes = 0;
            ((struct date_yy *)parm)->yySeconds = 0;
            ((struct date_yy *)parm)->yyMeridian = $2;
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U M]\n");
+#endif
        }
        | tUNUMBER ':' tUNUMBER o_merid {
            ((struct date_yy *)parm)->yyHour = $1;
            ((struct date_yy *)parm)->yyMinutes = $3;
            ((struct date_yy *)parm)->yySeconds = 0;
            ((struct date_yy *)parm)->yyMeridian = $4;
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U:U M]\n");
+#endif
+       }
+       | tUNUMBER ':' tUNUMBER rel {
+           ((struct date_yy *)parm)->yyHour = $1;
+           ((struct date_yy *)parm)->yyMinutes = $3;
+           ((struct date_yy *)parm)->yyMeridian = MER24;
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U:U rel]\n");
+#endif
        }
        | tUNUMBER ':' tUNUMBER tSNUMBER {
            ((struct date_yy *)parm)->yyHour = $1;
@@ -207,12 +221,27 @@
            ((struct date_yy *)parm)->yyTimezone = ($4 < 0
                          ? -$4 % 100 + (-$4 / 100) * 60
                          : - ($4 % 100 + ($4 / 100) * 60));
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U:U S]\n");
+#endif
        }
        | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid {
            ((struct date_yy *)parm)->yyHour = $1;
            ((struct date_yy *)parm)->yyMinutes = $3;
            ((struct date_yy *)parm)->yySeconds = $5;
            ((struct date_yy *)parm)->yyMeridian = $6;
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U:U:U M]\n");
+#endif
+       }
+       | tUNUMBER ':' tUNUMBER ':' tUNUMBER rel {
+           /* ISO 8601 format.  hh:mm:ss[+-][0-9]{2}([0-9]{2})?.  */
+           ((struct date_yy *)parm)->yyHour = $1;
+           ((struct date_yy *)parm)->yyMinutes = $3;
+           ((struct date_yy *)parm)->yySeconds = $5;
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U:U:U rel]\n");
+#endif
        }
        | tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
            /* ISO 8601 format.  hh:mm:ss[+-][0-9]{2}([0-9]{2})?.  */
@@ -227,6 +256,9 @@
                } else {
                        ((struct date_yy *)parm)->yyTimezone =  -$6 * 60;
                }
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+               printf("[U:U:U S]\n");
+#endif
        }
        ;
 
@@ -867,6 +899,9 @@
              date->yyInput--;
            }
          }
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+         printf ("T: %s\n", sign ? "tS" : "tU");
+#endif
          return sign ? tSNUMBER : tUNUMBER;
        }
       if (ISALPHA (c))
@@ -876,16 +911,27 @@
              *p++ = c;
          *p = '\0';
          date->yyInput--;
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+         printf ("T: LW\n");
+#endif
          return LookupWord (lvalp, buff);
        }
-      if (c != '(')
+      if (c != '(') {
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+       printf ("T: %c\n", *date->yyInput);
+#endif
        return *date->yyInput++;
+         }
       Count = 0;
       do
        {
          c = *date->yyInput++;
-         if (c == '\0')
+         if (c == '\0') {
+#ifdef PHP_DEBUG_PARSE_DATE_PARSER
+       printf ("T: %c\n", c);
+#endif
            return c;
+         }
          if (c == '(')
            Count++;
          else if (c == ')')

http://cvs.php.net/co.php/php-src/ext/standard/tests/time/bug27780.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/time/bug27780.phpt
+++ php-src/ext/standard/tests/time/bug27780.phpt

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

Reply via email to