derick Sat Aug 16 16:55:28 2003 EDT
Added files:
/php-src/ext/standard/tests/time bug17988.phpt
Modified files:
/php-src/ext/standard parsedate.y
/php-src NEWS
Log:
- Fixed bug #17988: strtotime fails to parse timestamp from postgresql
#- This is actually a feature request
Index: php-src/ext/standard/parsedate.y
diff -u php-src/ext/standard/parsedate.y:1.36 php-src/ext/standard/parsedate.y:1.37
--- php-src/ext/standard/parsedate.y:1.36 Mon Jul 28 00:01:32 2003
+++ php-src/ext/standard/parsedate.y Sat Aug 16 16:55:27 2003
@@ -8,7 +8,7 @@
** This code is in the public domain and has no copyright.
*/
-/* $Id: parsedate.y,v 1.36 2003/07/28 04:01:32 iliaa Exp $ */
+/* $Id: parsedate.y,v 1.37 2003/08/16 20:55:27 derick Exp $ */
#include "php.h"
@@ -228,6 +228,27 @@
((struct date_yy *)parm)->yyTimezone = -$6 * 60;
}
}
+ | tUNUMBER ':' tUNUMBER ':' tUNUMBER '.' tUNUMBER pgsqlzonepart {
+ ((struct date_yy *)parm)->yyHour = $1;
+ ((struct date_yy *)parm)->yyMinutes = $3;
+ ((struct date_yy *)parm)->yySeconds = $5;
+ ((struct date_yy *)parm)->yyMeridian = MER24;
+ }
+ ;
+
+pgsqlzonepart : tSNUMBER {
+ ((struct date_yy *)parm)->yyHaveZone++;
+ if ($1 <= -100 || $1 >= 100) {
+ ((struct date_yy *)parm)->yyTimezone =
+ -$1 % 100 + (-$1 / 100) * 60;
+ } else {
+ ((struct date_yy *)parm)->yyTimezone = -$1 * 60;
+ }
+ }
+ | zone {
+ ((struct date_yy *)parm)->yyHaveZone++;
+ }
+ | /* empty */
;
zone : tZONE {
Index: php-src/NEWS
diff -u php-src/NEWS:1.1450 php-src/NEWS:1.1451
--- php-src/NEWS:1.1450 Fri Aug 15 21:34:45 2003
+++ php-src/NEWS Sat Aug 16 16:55:28 2003
@@ -41,6 +41,7 @@
- Fixed bug #22367 (undefined variable has a value). (Zeev)
- Fixed bug #19859 (allow fast_call_user_function to support __call).
(Stanislav)
+- Fixed bug #17988 (strtotime failed to parse postgresql timestamp). (Derick)
29 Jun 2003, PHP 5 Beta 1
- Removed the bundled MySQL client library. (Sterling)
Index: php-src/ext/standard/tests/time/bug17988.phpt
+++ php-src/ext/standard/tests/time/bug17988.phpt
--TEST--
Bug #17988 strtotime handling of postgresql timestamps
--FILE--
<?php
putenv("TZ=GMT");
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 GMT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MET"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 MEST"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728 EDT"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+00"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-04"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+04"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0300"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0300"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728-0330"))."\n";
echo gmdate('Y-m-d H:i:s', strtotime("2002-06-25 14:18:48.543728+0330"))."\n";
?>
--EXPECT--
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 13:18:48
2002-06-25 12:18:48
2002-06-25 18:18:48
2002-06-25 14:18:48
2002-06-25 14:18:48
2002-06-25 18:18:48
2002-06-25 10:18:48
2002-06-25 17:18:48
2002-06-25 11:18:48
2002-06-25 17:48:48
2002-06-25 10:48:48
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php