derick Tue Jan 29 20:08:42 2008 UTC
Added files:
/php-src/ext/date/tests bug43960.phpt
Modified files:
/php-src/ext/date/lib parse_date.re
Log:
- Fixed bug #43960 (strtotime() returns timestamp in the future when given a
bogus string).
http://cvs.php.net/viewvc.cgi/php-src/ext/date/lib/parse_date.re?r1=1.68&r2=1.69&diff_format=u
Index: php-src/ext/date/lib/parse_date.re
diff -u php-src/ext/date/lib/parse_date.re:1.68
php-src/ext/date/lib/parse_date.re:1.69
--- php-src/ext/date/lib/parse_date.re:1.68 Sun Jan 27 22:15:59 2008
+++ php-src/ext/date/lib/parse_date.re Tue Jan 29 20:08:41 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: parse_date.re,v 1.68 2008/01/27 22:15:59 derick Exp $ */
+/* $Id: parse_date.re,v 1.69 2008/01/29 20:08:41 derick Exp $ */
#include "timelib.h"
@@ -107,7 +107,7 @@
#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1;
s->time->relative.weekday_behavior = 1; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_SPECIAL_RELATIVE() { s->time->have_special_relative = 1; }
-#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) {
add_warning(s, "Double timezone specification"); timelib_string_free(str);
return TIMELIB_ERROR; } else { s->time->have_zone = 1; } }
+#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) {
s->time->have_zone > 1 ? add_error(s, "Double timezone specification") :
add_warning(s, "Double timezone specification"); timelib_string_free(str);
s->time->have_zone++; return TIMELIB_ERROR; } else { s->time->have_zone++; } }
#define TIMELIB_INIT s->cur = cursor; str = timelib_string(s); ptr = str
#define TIMELIB_DEINIT timelib_string_free(str)
@@ -755,6 +755,9 @@
while (**ptr == ' ' || **ptr == '\t' || **ptr == '(') {
++*ptr;
}
+ if ((*ptr)[0] == 'G' && (*ptr)[1] == 'M' && (*ptr)[2] == 'T' &&
((*ptr)[3] == '+' | (*ptr)[3] == '-')) {
+ *ptr += 3;
+ }
if (**ptr == '+') {
++*ptr;
t->is_localtime = 1;
@@ -845,7 +848,7 @@
secondlz = minutelz | "60";
meridian = ([AaPp] "."? [Mm] "."?) [\000\t ];
tz = "("? [A-Za-z]{1,6} ")"? | [A-Z][a-z]+([_/][A-Z][a-z]+)+;
-tzcorrection = [+-] hour24 ":"? minute?;
+tzcorrection = "GMT"? [+-] hour24 ":"? minute?;
daysuf = "st" | "nd" | "rd" | "th";
http://cvs.php.net/viewvc.cgi/php-src/ext/date/tests/bug43960.phpt?view=markup&rev=1.1
Index: php-src/ext/date/tests/bug43960.phpt
+++ php-src/ext/date/tests/bug43960.phpt
--TEST--
Bug #43960 (strtotime() returns timestamp in the future when given a bogus
string)
--FILE--
<?php
var_dump(strtotime('i like to eat slices at work'));
?>
--EXPECT--
bool(false)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php