#48091 [Bgs]: strtotime(+1 wed,time()); doesn't work

2009-05-06 Thread mwu at oxid8 dot com
 ID:   48091
 User updated by:  mwu at oxid8 dot com
 Reported By:  mwu at oxid8 dot com
 Status:   Bogus
 Bug Type: Date/time related
 Operating System: CentOS release 5.2 (Final)
 PHP Version:  5.2.9
 New Comment:

Is this bug going to be addressed? This is a BUG or regression.  The 
behavior is different between 5.2.6 and 5.2.9


Previous Comments:


[2009-04-27 20:55:20] mwu at oxid8 dot com

The output as you see here is not as expected..

When I do this in php 5.2.6, I get this:
Wed, 29 Apr 2009 00:00:00 -0500
Wed, 06 May 2009 00:00:00 -0500
Wed, 13 May 2009 00:00:00 -0500


In php 5.2.9 I get this:
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300



[2009-04-27 20:27:14] j...@php.net

Try fixing your script first. This works:

?php
function test($sInterval,$iNextDate) {
$iNextDate = strtotime($sInterval,$iNextDate);
echo date(r, $iNextDate), \n;
$iNextDate = strtotime($sInterval,$iNextDate);
echo date(r, $iNextDate), \n;
$iNextDate = strtotime($sInterval,$iNextDate);
echo date(r, $iNextDate), \n;
}

$iNextDate = time();
test(+1 Wed,$iNextDate);
test(+1 day,$iNextDate);
test(+1 week,$iNextDate);
?

And output is as expected:
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300
Tue, 28 Apr 2009 23:26:44 +0300
Wed, 29 Apr 2009 23:26:44 +0300
Thu, 30 Apr 2009 23:26:44 +0300
Mon, 04 May 2009 23:26:44 +0300
Mon, 11 May 2009 23:26:44 +0300
Mon, 18 May 2009 23:26:44 +0300





[2009-04-27 20:06:38] mwu at oxid8 dot com

Description:

This worked prior to php 5.2.9  (at least its working in 5.2.6)

strtotime(+1 Wed,time())  would yield a timestamp that is 1 Wednesday

from the current time. So if the current date is Monday April 27,2009 
3pm, then the resulting function would return May 6, 2009 3pm.  in
5.2.9 
executing this function returns the same timestamp.

Reproduce code:
---
function test($sInterval,$iNextDate) {
echo strtotime(\$sInterval\,$iNextDate);br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo br/;
}

$iNextDate = time(); 
test(+1 Wed,$iNextDate);
test(+1 day,$iNextDate);
test(+1 week,$iNextDate);



Actual result:
--
strtotime(+1 Wed,1240860865);
1240981200
1240981200
1240981200

strtotime(+1 day,1240860865);
1240947265
1241033665
1241120065

strtotime(+1 week,1240860865);
1241465665
1242070465
1242675265






-- 
Edit this bug report at http://bugs.php.net/?id=48091edit=1



#48091 [NEW]: strtotime(+1 wed,time()); doesn't work

2009-04-27 Thread mwu at oxid8 dot com
From: mwu at oxid8 dot com
Operating system: CentOS release 5.2 (Final) 
PHP version:  5.2.9
PHP Bug Type: Date/time related
Bug description:  strtotime(+1 wed,time()); doesn't work

Description:

This worked prior to php 5.2.9  (at least its working in 5.2.6)

strtotime(+1 Wed,time())  would yield a timestamp that is 1 Wednesday 
from the current time. So if the current date is Monday April 27,2009 
3pm, then the resulting function would return May 6, 2009 3pm.  in 5.2.9 
executing this function returns the same timestamp.

Reproduce code:
---
function test($sInterval,$iNextDate) {
echo strtotime(\$sInterval\,$iNextDate);br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo br/;
}

$iNextDate = time(); 
test(+1 Wed,$iNextDate);
test(+1 day,$iNextDate);
test(+1 week,$iNextDate);



Actual result:
--
strtotime(+1 Wed,1240860865);
1240981200
1240981200
1240981200

strtotime(+1 day,1240860865);
1240947265
1241033665
1241120065

strtotime(+1 week,1240860865);
1241465665
1242070465
1242675265


-- 
Edit bug report at http://bugs.php.net/?id=48091edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48091r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48091r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48091r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48091r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48091r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48091r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=48091r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=48091r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=48091r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=48091r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=48091r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=48091r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=48091r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48091r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=48091r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=48091r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=48091r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=48091r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=48091r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=48091r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=48091r=mysqlcfg



#48091 [Bgs]: strtotime(+1 wed,time()); doesn't work

2009-04-27 Thread mwu at oxid8 dot com
 ID:   48091
 User updated by:  mwu at oxid8 dot com
 Reported By:  mwu at oxid8 dot com
 Status:   Bogus
 Bug Type: Date/time related
 Operating System: CentOS release 5.2 (Final)
 PHP Version:  5.2.9
 New Comment:

The output as you see here is not as expected..

When I do this in php 5.2.6, I get this:
Wed, 29 Apr 2009 00:00:00 -0500
Wed, 06 May 2009 00:00:00 -0500
Wed, 13 May 2009 00:00:00 -0500


In php 5.2.9 I get this:
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300


Previous Comments:


[2009-04-27 20:27:14] j...@php.net

Try fixing your script first. This works:

?php
function test($sInterval,$iNextDate) {
$iNextDate = strtotime($sInterval,$iNextDate);
echo date(r, $iNextDate), \n;
$iNextDate = strtotime($sInterval,$iNextDate);
echo date(r, $iNextDate), \n;
$iNextDate = strtotime($sInterval,$iNextDate);
echo date(r, $iNextDate), \n;
}

$iNextDate = time();
test(+1 Wed,$iNextDate);
test(+1 day,$iNextDate);
test(+1 week,$iNextDate);
?

And output is as expected:
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300
Wed, 29 Apr 2009 00:00:00 +0300
Tue, 28 Apr 2009 23:26:44 +0300
Wed, 29 Apr 2009 23:26:44 +0300
Thu, 30 Apr 2009 23:26:44 +0300
Mon, 04 May 2009 23:26:44 +0300
Mon, 11 May 2009 23:26:44 +0300
Mon, 18 May 2009 23:26:44 +0300





[2009-04-27 20:06:38] mwu at oxid8 dot com

Description:

This worked prior to php 5.2.9  (at least its working in 5.2.6)

strtotime(+1 Wed,time())  would yield a timestamp that is 1 Wednesday

from the current time. So if the current date is Monday April 27,2009 
3pm, then the resulting function would return May 6, 2009 3pm.  in
5.2.9 
executing this function returns the same timestamp.

Reproduce code:
---
function test($sInterval,$iNextDate) {
echo strtotime(\$sInterval\,$iNextDate);br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo $iNextDate = strtotime($sInterval,$iNextDate) . br/;
echo br/;
}

$iNextDate = time(); 
test(+1 Wed,$iNextDate);
test(+1 day,$iNextDate);
test(+1 week,$iNextDate);



Actual result:
--
strtotime(+1 Wed,1240860865);
1240981200
1240981200
1240981200

strtotime(+1 day,1240860865);
1240947265
1241033665
1241120065

strtotime(+1 week,1240860865);
1241465665
1242070465
1242675265






-- 
Edit this bug report at http://bugs.php.net/?id=48091edit=1