[php-maint] Re: php4 strtotime bug?

Anthony Tippett atippett at gmail.com
Wed Sep 21 01:22:26 UTC 2005


Another interesting fact shows woody displaying this code correctly:

strtotime of 2005-01-01 = 1104566400
strtotime of 2005-01-01 shifting -35 years = 28800
date of 28800 = 1970-01-01
strtotime of 2005-01-01 shifting -36 years = -31507200
date of -31507200 = 1969-01-01



Anthony Tippett wrote:

>Before I submit I bug report, I'd like to describe the issue that I'm
>having in hopes that you can give me some ideas on debugging it.  This
>issue deals with the strtotime function and the differences I'm seeing
>between sarge and sid.  Recently, this issue started to occur when using
>strtotime in the form of strtotime("-38 years", $timestamp) on stable
>(sarge).  On Sarge, strtotime returns -1 however, on sid strtotime
>reports the correct time stamp.  I've tried this on 2 Sarge boxes
>without luck and am fairly certain that this issue has come about within
>the last month. Please let me know if there is anything more I can do to
>try and debug this or let me know if I should submit it as a php4 bug.
>
>information:
>
>
>Here is some code examples and output of what I get on each dist:
>
>
>Code:
>
><?php
>$a = "2005-01-01";
>$b = strtotime($a);
>$c = -35;
>$c2 = -36;
>print "strtotime of $a = $b\n";
>
>$d = strtotime("-$c years", $b);
>print "strtotime of $a shifting $c years = $d\n";
>print "date of $d = ".date("Y-m-d", $d)."\n";
>
>$d2 = strtotime("-$c2 years", $b);
>print "strtotime of $a shifting $c2 years = $d2\n";
>print "date of $d2 = ".date("Y-m-d", $d2)."\n";
>?>
>
>
>Sid Output (php version4:4.4.0-2)
>
>strtotime of 2005-01-01 = 1104566400
>strtotime of 2005-01-01 shifting -35 years = 28800
>date of 28800 = 1970-01-01
>strtotime of 2005-01-01 shifting -36 years = -31507200
>date of -31507200 = 1969-01-01
>
>Sarge Output(4:4.3.10-16)
>
>strtotime of 2005-01-01 = 1104566400
>strtotime of 2005-01-01 shifting -35 years = 28800
>date of 28800 = 1970-01-01
>strtotime of 2005-01-01 shifting -36 years = -1
>date of -1 = 1969-12-31
>
>
>Also interesting when running the date command on Sarge the date
>arithmatic seems to work.  I'm not sure if they use the same libraries.
>   
>    date --date='-36 years' +'Last month was %Y?'
>
>    Last month was 1969?
>
>  
>

-- 
Anthony Tippett - 425.443.3152 - Etomic.NET - Software Engineer 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: atippett.vcf
Type: text/x-vcard
Size: 128 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-php-maint/attachments/20050920/2d8af891/atippett.vcf


More information about the pkg-php-maint mailing list