Bug #51096 [Csd->ReO]: strtotime returns wrong results
| From: | derick@php.net | Date: | Tue, 09 Mar 2010 08:49:36 +0000 |
| Subject: | Bug #51096 [Csd->ReO]: strtotime returns wrong results | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-148422@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51096&edit=1
ID: 51096
Updated by: derick@php.net
Reported by: phpbugs at rizzt dot kicks-ass dot org
Summary: strtotime returns wrong results
-Status: Closed
+Status: Re-Opened
Type: Bug
Package: Date/time related
Operating System: linux
PHP Version: 5.2.12
Assigned To: derick
New Comment:
Re-opening because of the question marks:
firstdayof = 'first day of'?;
lastdayof = 'last day of'?;
It shouldn't cause an issue though, but it needs fixing.
Previous Comments:
------------------------------------------------------------------------
[2010-03-06 17:05:05] derick@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2010-03-06 17:04:57] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&revision=295892
Log: - Fixed bug #51096 ('last day' and 'first day' are handled
incorrectly when
parsing date strings).
- For 5.2 I just added the test case minus new 5.3 additions.
------------------------------------------------------------------------
[2010-02-20 17:10:49] derick@php.net
Actually, there is a bug here "first day" and "last day" should be "+1
day" and "-1 day".
------------------------------------------------------------------------
[2010-02-20 15:22:05] derick@php.net
That's because those things were introduced in PHP 5.3:
derick@kossu:~$ pe 5.2dev
derick@kossu:~$ php
<?php
echo strftime('1 %Y/%m/%d')."\n";
echo strftime('2 %Y/%m/%d', strtotime('first day'))."\n";
echo strftime('3 %Y/%m/%d', strtotime('last day'))."\n";
echo strftime('4 %Y/%m/%d', strtotime('next month'))."\n";
echo strftime('5 %Y/%m/%d', strtotime('first day next month'))."\n";
echo strftime('6 %Y/%m/%d', strtotime('last day next month'))."\n";
?>
1 2010/02/20
2 2010/02/21
3 2010/02/19
4 2010/03/20
5 2010/03/21
6 2010/03/19
derick@kossu:~$ pe 5.3dev
derick@kossu:~$ php
<?php
echo strftime('1 %Y/%m/%d')."\n";
echo strftime('2 %Y/%m/%d', strtotime('first day'))."\n";
echo strftime('3 %Y/%m/%d', strtotime('last day'))."\n";
echo strftime('4 %Y/%m/%d', strtotime('next month'))."\n";
echo strftime('5 %Y/%m/%d', strtotime('first day next month'))."\n";
echo strftime('6 %Y/%m/%d', strtotime('last day next month'))."\n";
?>
1 2010/02/20
2 2010/02/01
3 2010/02/28
4 2010/03/20
5 2010/03/01
6 2010/03/31
------------------------------------------------------------------------
[2010-02-20 15:20:45] phpbugs at rizzt dot kicks-ass dot org
Sorry, I forgot to change 2 & 3
Expected result:
----------------
1 2010/02/20
2 2010/02/01
3 2010/02/28
4 2010/03/20
5 2010/03/01
6 2010/03/31
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=51096
--
Edit this bug report at http://bugs.php.net/bug.php?id=51096&edit=1