|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28344 Memory/Stack or mktime() problem
Submitted: 2004-05-10 09:19 UTC Modified: 2004-07-19 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: powerstat at web dot de Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 4.3.6 OS: RedHat AS 2.1 IA64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: powerstat at web dot de
New email:
PHP Version: OS:


 [2004-05-10 09:19 UTC] powerstat at web dot de
PHP has a function called mktime()
this uses internally the Unix/Linux mktime() function.

We detected the problem within the phpGroupWare
(actual cvs checkout from branch 0.9.16) 
cvs repositories:

The bug itself will occur in the following file:

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.

  case 0:
    $sday = mktime(2,0,0,$month,$day - 6,$year);
  case 1:
    $sday = mktime(2,0,0,$month,$day,$year);
    $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:
:2004/4/-2 : 1080518400:
:2004/6/0 : 1085961600:
:2004/05/-4 : 1082937600:
:2004/05/-4 : 1082937600:

wrong output values 64 bit itanium2:
:2004/4/-2 : 1080694800:
:2004/6/0 : 1085965200:
:2004/05/-4 : 1083286800:
:2004/05/-4 : 1083286800:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-19 01:00 UTC] 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".
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC