#28344 [Com]: Memory/Stack or mktime() problem
| From: | wer2 at meta dot ua | Date: | Fri, 18 Jul 2008 20:59:05 +0000 |
| Subject: | #28344 [Com]: Memory/Stack or mktime() problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-126972@lists.php.net to get a copy of this message | ||
ID: 28344
Comment by: wer2 at meta dot ua
Reported By: powerstat at web dot de
Status: No Feedback
Bug Type: Date/time related
Operating System: RedHat AS 2.1 IA64
PHP Version: 4.3.6
New Comment:
OMG AMAZING FTW!!!
http://zoo-fucking.wikidot.com
http://zootube365.wikidot.com
http://zootube-com.wikidot.com
http://zootube-beastiality.wikidot.com
Previous Comments:
------------------------------------------------------------------------
[2008-07-18 20:58:03] wer1 at meta dot ua
OMG, amazing ftw!!!
http://zoofucking.wiki.zoho.com/zoo-fucking.html
http://zoofucking.wiki.zoho.com/zootube365.html
http://zoofucking.wiki.zoho.com/Beastiality-video.html
http://zoofucking.wiki.zoho.com/zootube-com.html
------------------------------------------------------------------------
[2004-07-19 01:00:07] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2004-07-11 21:45:56] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2004-05-10 09:19:19] powerstat at web dot de
Description:
------------
PHP has a function called mktime()
(see http://www.php.net/manual/en/function.mktime.php)
this uses internally the Unix/Linux mktime() function.
We detected the problem within the phpGroupWare
(actual cvs checkout from branch 0.9.16)
www.phpgroupware.org
cvs repositories:
https://savannah.gnu.org/projects/phpgwapi
and
https://savannah.gnu.org/projects/phpgroupware/
The bug itself will occur in the following file:
http://savannah.gnu.org/cgi-bin/viewcvs/phpgwapi/phpgwapi/inc/class.datetime.inc.php?rev=1.5.2.12.2.8&content-type=text/vnd.viewcvs-markup
in the method
function get_weekday_start($year,$month,$day)
when php mktime() will be called, the result (in seconds) will be off
by 2 days. This happens especially when zero or negative day values will
be used.
These values are allowed by php mktime() as well as by the underlying
unix mktime()
(see Itanium man mktime).
We found that the problem only occurs in the above file,
using the same values in a small test script will give backe the
correct results!
We assume that it might be a memory/stack problem within php itself,
that we are not able to track down.
Reproduce code:
---------------
For URLs see description.
switch($weekday)
{
case 0:
$sday = mktime(2,0,0,$month,$day - 6,$year);
break;
case 1:
$sday = mktime(2,0,0,$month,$day,$year);
break;
default:
$sday = mktime(2,0,0,$month,$day - ($weekday - 1),$year);
echo ':' . $day . ':' . $weekday . "<br />\n";
echo ':' . $year . '/' . $month . '/' . ($day - ($weekday - 1)) .
'
: ' . $sday . ":<br /><hr />\n";
}
Expected result:
----------------
The correct value in seconds (differs a bit by tomezone settings), but
not values that are 2 days or more off.
orrect Output values here 32bit linux machine:
:1:4
:2004/4/-2 : 1080518400:
:1:2
:2004/6/0 : 1085961600:
:1:6
:2004/05/-4 : 1082937600:
:1:6
:2004/05/-4 : 1082937600:
wrong output values 64 bit itanium2:
:1:4
:2004/4/-2 : 1080694800:
:1:2
:2004/6/0 : 1085965200:
:1:6
:2004/05/-4 : 1083286800:
:1:6
:2004/05/-4 : 1083286800:
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28344&edit=1