cvs: php4(PHP_4_0_7) /ext/standard parsedate.y /ext/standard/tests/time 002.phpt
| From: | Derick Rethans | Date: | Sat, 27 Oct 2001 17:56:20 +0000 |
| Subject: | cvs: php4(PHP_4_0_7) /ext/standard parsedate.y /ext/standard/tests/time 002.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-8000@lists.php.net to get a copy of this message | ||
derick Sat Oct 27 13:56:20 2001 EDT
Modified files: (Branch: PHP_4_0_7)
/php4/ext/standard parsedate.y
/php4/ext/standard/tests/time 002.phpt
Log:
- MFH for bug fix of #9640 and #13789
Index: php4/ext/standard/parsedate.y
diff -u php4/ext/standard/parsedate.y:1.27 php4/ext/standard/parsedate.y:1.27.4.1
--- php4/ext/standard/parsedate.y:1.27 Sun May 6 14:53:45 2001
+++ php4/ext/standard/parsedate.y Sat Oct 27 13:56:20 2001
@@ -249,14 +249,17 @@
yyMeridian = $6;
}
| tUNUMBER ':' tUNUMBER ':' tUNUMBER tSNUMBER {
+ /* ISO 8601 format. hh:mm:ss[+-][0-9]{2}([0-9]{2})?. */
yyHour = $1;
yyMinutes = $3;
yySeconds = $5;
yyMeridian = MER24;
yyHaveZone++;
- yyTimezone = ($6 < 0
- ? -$6 % 100 + (-$6 / 100) * 60
- : - ($6 % 100 + ($6 / 100) * 60));
+ if ($6 < -100 || $6 > 100) {
+ yyTimezone = -$6 % 100 + (-$6 / 100) * 60;
+ } else {
+ yyTimezone = -$6 * 60;
+ }
}
;
Index: php4/ext/standard/tests/time/002.phpt
diff -u php4/ext/standard/tests/time/002.phpt:1.1.4.1 php4/ext/standard/tests/time/002.phpt:1.1.4.2
--- php4/ext/standard/tests/time/002.phpt:1.1.4.1 Sun Oct 21 22:36:04 2001
+++ php4/ext/standard/tests/time/002.phpt Sat Oct 27 13:56:20 2001
@@ -4,39 +4,59 @@
--GET--
--FILE--
<?php
- putenv("TZ=GMT");
-
- echo "1999-10-13\n";
- echo strtotime ("1999-10-13")."\n";
- echo strtotime ("Oct 13 1999")."\n\n";
-
- echo "2000-01-19\n";
- echo strtotime ("2000-01-19")."\n";
- echo strtotime ("Jan 19 2000")."\n\n";
-
- echo "2001-12-21\n";
- echo strtotime ("2001-12-21")."\n";
- echo strtotime ("Dec 21 2001")."\n\n";
-
- echo "2001-12-21 12:16\n";
- echo strtotime ("2001-12-21 12:16")."\n";
- echo strtotime ("Dec 21 2001 12:16")."\n";
- echo strtotime ("Dec 21 12:16")."\n";
+ $dates = array (
+ "1999-10-13",
+ "Oct 13 1999",
+ "2000-01-19",
+ "Jan 19 2000",
+ "2001-12-21",
+ "Dec 21 2001",
+ "2001-12-21 12:16",
+ "Dec 21 2001 12:16",
+ "Dec 21 12:16",
+ "2001-10-22 21:19:58",
+ "2001-10-22 21:19:58-02",
+ "2001-10-22 21:19:58-0213",
+ "2001-10-22 21:19:58+02",
+ "2001-10-22 21:19:58+0213"
+ );
+
+ putenv ("TZ=GMT");
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
+
+ putenv ("TZ=Europe/Amsterdam");
+ foreach ($dates as $date) {
+ echo date ("Y-m-d H:i:s\n", strtotime ($date));
+ }
?>
--EXPECT--
-1999-10-13
-939772800
-939772800
-
-2000-01-19
-948240000
-948240000
-
-2001-12-21
-1008892800
-1008892800
-
-2001-12-21 12:16
-1008936960
-1008936960
--1
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+1969-12-31 23:59:59
+2001-10-22 21:19:58
+2001-10-22 23:19:58
+2001-10-22 23:32:58
+2001-10-22 19:19:58
+2001-10-22 19:06:58
+1999-10-13 00:00:00
+1999-10-13 00:00:00
+2000-01-19 00:00:00
+2000-01-19 00:00:00
+2001-12-21 00:00:00
+2001-12-21 00:00:00
+2001-12-21 12:16:00
+2001-12-21 12:16:00
+1970-01-01 00:59:59
+2001-10-22 21:19:58
+2001-10-23 01:19:58
+2001-10-23 01:32:58
+2001-10-22 21:19:58
+2001-10-22 21:06:58