derick Wed Jul 23 18:50:51 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/date/tests bug43452.phpt
Modified files: /php-src/ext/date/lib parse_date.re parse_date.c /php-src NEWS Log: - MFH: Fixed bug #43452 (strings containing a weekday, or a number plus weekday behaved incorrect of the current day-of-week was the same as the one in the phrase). http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.26.2.27.2.12.2.20&r2=1.26.2.27.2.12.2.21&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.20 php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.21 --- php-src/ext/date/lib/parse_date.re:1.26.2.27.2.12.2.20 Wed Jul 16 15:41:01 2008 +++ php-src/ext/date/lib/parse_date.re Wed Jul 23 18:50:18 2008 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: parse_date.re,v 1.26.2.27.2.12.2.20 2008/07/16 15:41:01 derick Exp $ */ +/* $Id: parse_date.re,v 1.26.2.27.2.12.2.21 2008/07/23 18:50:18 derick Exp $ */ #include "timelib.h" @@ -1680,7 +1680,7 @@ while(*ptr) { i = timelib_get_unsigned_nr((char **) &ptr, 24); timelib_eat_spaces((char **) &ptr); - timelib_set_relative((char **) &ptr, i, 0, s); + timelib_set_relative((char **) &ptr, i, 1, s); } TIMELIB_DEINIT; return TIMELIB_RELATIVE; http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.c?r1=1.29.2.30.2.14.2.22&r2=1.29.2.30.2.14.2.23&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.22 php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.23 --- php-src/ext/date/lib/parse_date.c:1.29.2.30.2.14.2.22 Wed Jul 16 15:40:41 2008 +++ php-src/ext/date/lib/parse_date.c Wed Jul 23 18:50:18 2008 @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Wed Jul 16 17:24:19 2008 */ +/* Generated by re2c 0.13.5 on Wed Jul 23 19:59:35 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.22 2008/07/16 15:40:41 derick Exp $ */ +/* $Id: parse_date.c,v 1.29.2.30.2.14.2.23 2008/07/23 18:50:18 derick Exp $ */ #include "timelib.h" @@ -2749,7 +2749,7 @@ while(*ptr) { i = timelib_get_unsigned_nr((char **) &ptr, 24); timelib_eat_spaces((char **) &ptr); - timelib_set_relative((char **) &ptr, i, 0, s); + timelib_set_relative((char **) &ptr, i, 1, s); } TIMELIB_DEINIT; return TIMELIB_RELATIVE; http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.213&r2=1.2027.2.547.2.965.2.214&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.213 php-src/NEWS:1.2027.2.547.2.965.2.214 --- php-src/NEWS:1.2027.2.547.2.965.2.213 Wed Jul 23 14:10:04 2008 +++ php-src/NEWS Wed Jul 23 18:50:37 2008 @@ -249,6 +249,9 @@ - Fixed bug #43808 (date_create never fails (even when it should)). (Derick) - Fixed bug #43527 (DateTime created from a timestamp reports environment timezone). (Derick) +- Fixed bug #43452 (strings containing a weekday, or a number plus weekday + behaved incorrect of the current day-of-week was the same as the one in the + phrase). (Derick) - Fixed bug #43426 (crash on nested call_user_func() calls). (Dmitry) - Fixed bug #43323 (Wrong count abstract methods). (Felipe, Dmitry) - Fixed bug #43261 (Use ^ as the escape with escapeshellcmd() on Windows). (Scott) http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug43452.phpt?view=markup&rev=1.1 Index: php-src/ext/date/tests/bug43452.phpt +++ php-src/ext/date/tests/bug43452.phpt --TEST-- Bug #43452 ("weekday" is not equivalent to "1 weekday" of the current weekday is "weekday") --INI-- date.default_timezone=Europe/Oslo --FILE-- <?php // <day> is equivalent to 1 <day> and will *not* forward if the current day // (November 1st) is the same day of week. $day = strtotime( "Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "1 Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "2 Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "3 Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n\n"; // forward one week, then behaves like above for week days $day = strtotime( "Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "+1 week Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "+2 week Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "+3 week Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n\n"; // First, second, etc skip to the first/second weekday *after* the current day. // This makes "first thursday" equivalent to "+1 week thursday" - but only // if the current day-of-week is the one mentioned in the phrase. $day = strtotime( "Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "first Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "second Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "third Thursday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n\n"; // Now the same where the current day-of-week does not match the one in the // phrase. $day = strtotime( "Friday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "first Friday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "second Friday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n"; $day = strtotime( "third Friday Nov 2007" ); echo date( DateTime::ISO8601, $day ), "\n\n"; ?> --EXPECT-- 2007-11-01T00:00:00+0100 2007-11-01T00:00:00+0100 2007-11-08T00:00:00+0100 2007-11-15T00:00:00+0100 2007-11-01T00:00:00+0100 2007-11-08T00:00:00+0100 2007-11-15T00:00:00+0100 2007-11-22T00:00:00+0100 2007-11-01T00:00:00+0100 2007-11-08T00:00:00+0100 2007-11-15T00:00:00+0100 2007-11-22T00:00:00+0100 2007-11-02T00:00:00+0100 2007-11-02T00:00:00+0100 2007-11-09T00:00:00+0100 2007-11-16T00:00:00+0100 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php