svn: /php/php-src/ branches/PHP_5_3/ext/date/tests/bug52342.phpt trunk/ext/date/tests/bug52342.phpt
| From: | Derick Rethans | Date: | Mon, 30 Aug 2010 16:48:21 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/ext/date/tests/bug52342.phpt trunk/ext/date/tests/bug52342.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63397@lists.php.net to get a copy of this message | ||
derick Mon, 30 Aug 2010 16:48:21 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=302893
Log:
- Tests for bug #52342 (DateTime setIsoDate results in wrong timestamp).
Bug: http://bugs.php.net/52342 (Assigned) DateTime
setIsoDate results in wrong timestamp
Changed paths:
A php/php-src/branches/PHP_5_3/ext/date/tests/bug52342.phpt
A php/php-src/trunk/ext/date/tests/bug52342.phpt
Added: php/php-src/branches/PHP_5_3/ext/date/tests/bug52342.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/date/tests/bug52342.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/date/tests/bug52342.phpt 2010-08-30 16:48:21 UTC (rev 302893)
@@ -0,0 +1,23 @@
+--TEST--
+Bug #52342 (DateTime setIsoDate results in wrong timestamp)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Berlin');
+$from = new DateTime();
+$from->setTime(0, 0, 0);
+$from->setISODate(2010, 28, 1); //Montag der 28ten Woche 2010
+
+echo $from->format('d.m.Y H:i'), "\n"; //A
+echo $from->getTimestamp(), "\n"; //B
+echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
+
+$from->add(new DateInterval('P0D'));
+echo $from->getTimestamp(), "\n"; //B
+echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
+?>
+--EXPECT--
+12.07.2010
+1278885600
+12.07.2010 00:00
+1278885600
+12.07.2010 00:00
Added: php/php-src/trunk/ext/date/tests/bug52342.phpt
===================================================================
--- php/php-src/trunk/ext/date/tests/bug52342.phpt (rev 0)
+++ php/php-src/trunk/ext/date/tests/bug52342.phpt 2010-08-30 16:48:21 UTC (rev 302893)
@@ -0,0 +1,23 @@
+--TEST--
+Bug #52342 (DateTime setIsoDate results in wrong timestamp)
+--FILE--
+<?php
+date_default_timezone_set('Europe/Berlin');
+$from = new DateTime();
+$from->setTime(0, 0, 0);
+$from->setISODate(2010, 28, 1); //Montag der 28ten Woche 2010
+
+echo $from->format('d.m.Y H:i'), "\n"; //A
+echo $from->getTimestamp(), "\n"; //B
+echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
+
+$from->add(new DateInterval('P0D'));
+echo $from->getTimestamp(), "\n"; //B
+echo date('d.m.Y H:i', $from->getTimestamp()), "\n"; //C
+?>
+--EXPECT--
+12.07.2010
+1278885600
+12.07.2010 00:00
+1278885600
+12.07.2010 00:00