diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2003-07-28 04:01:32 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2003-07-28 04:01:32 +0000 |
| commit | f9cf39bd30c33e074bdc3577d0aca97b5b0efd97 (patch) | |
| tree | 0b48040d4869a07920ced3e12cb979c5485f96ad | |
| parent | 8aef486417781b51d4aa179e48584b62e518a016 (diff) | |
| download | php-git-f9cf39bd30c33e074bdc3577d0aca97b5b0efd97.tar.gz | |
Fixed bug #13142 (strtotime not handling "M d H:i:s Y" format)
| -rw-r--r-- | ext/standard/parsedate.y | 11 | ||||
| -rw-r--r-- | ext/standard/tests/time/bug13142.phpt | 16 |
2 files changed, 27 insertions, 0 deletions
diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y index 28ba0cd401..6fe1fb1b13 100644 --- a/ext/standard/parsedate.y +++ b/ext/standard/parsedate.y @@ -260,6 +260,17 @@ date : tUNUMBER '/' tUNUMBER { ((struct date_yy *)parm)->yyMonth = $1; ((struct date_yy *)parm)->yyDay = $3; } + | tMONTH tUNUMBER tUNUMBER ':' tUNUMBER ':' tUNUMBER tUNUMBER { + ((struct date_yy *)parm)->yyYear = $8; + ((struct date_yy *)parm)->yyMonth = $1; + ((struct date_yy *)parm)->yyDay = $2; + + ((struct date_yy *)parm)->yyHour = $3; + ((struct date_yy *)parm)->yyMinutes = $5; + ((struct date_yy *)parm)->yySeconds = $7; + + ((struct date_yy *)parm)->yyHaveTime = 1; + } | tUNUMBER '/' tUNUMBER '/' tUNUMBER { /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY. The goal in recognizing YYYY/MM/DD is solely to support legacy diff --git a/ext/standard/tests/time/bug13142.phpt b/ext/standard/tests/time/bug13142.phpt new file mode 100644 index 0000000000..6e2bf87d31 --- /dev/null +++ b/ext/standard/tests/time/bug13142.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #13142 strtotime handling of "M d H:i:s Y" format +--SKIPIF-- +<?php +if (!@putenv("TZ=US/Eastern") || getenv("TZ") != 'US/Eastern') { + die("skip unable to change TZ enviroment variable\n"); +} +?> +--FILE-- +<?php +echo date("r\n", strtotime("Sep 04 16:39:45 2001")); +echo date("r\n", strtotime("Sep 04 2001 16:39:45")); +?> +--EXPECT-- +Tue, 4 Sep 2001 16:39:45 -0400 +Tue, 4 Sep 2001 16:39:45 -0400 |
