php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46417 getdate returns "unknown" for higher negative values
Submitted: 2008-10-29 10:18 UTC Modified: 2009-05-11 01:00 UTC
From: sanjay dot mantoor at gmail dot com Assigned: derick (profile)
Status: No Feedback Package: Date/time related
PHP Version: 5CVS-2008-10-29 (snap) OS: * (64bit)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sanjay dot mantoor at gmail dot com
New email:
PHP Version: OS:

 

 [2008-10-29 10:18 UTC] sanjay dot mantoor at gmail dot com
Description:
------------
getdate function returns wrong "weekday" for higher negative timestamps like  -12.3456789000e10. This is observed on linux 64 bit with both php5.2 and php5.3 release. 

As per documentation "weekday" should be "Sunday through Saturday".
But in this case it returns "Unknown" value.

Checked with php version
PHP 5.3.0alpha3-dev (cli) (built: Oct 29 2008 15:20:01)



Reproduce code:
---------------
<?php
$timestamp=-12.3456789000e10;
var_dump( getdate($timestamp) );
?>


Expected result:
----------------
array(11) {
  ["seconds"]=>
  int(20)
  ["minutes"]=>
  int(23)
  ["hours"]=>
  int(5)
  ["mday"]=>
  int(23)
  ["wday"]=>
  int(-4)
  ["mon"]=>
  int(10)
  ["year"]=>
  int(-1943)
  ["yday"]=>
  int(295)
  ["weekday"]=>
  string(7) "Monday"
  ["month"]=>
  string(7) "October"
  [0]=>
  int(-123456789000)
}


Actual result:
--------------
array(11) {
  ["seconds"]=>
  int(20)
  ["minutes"]=>
  int(23)
  ["hours"]=>
  int(5)
  ["mday"]=>
  int(23)
  ["wday"]=>
  int(-4)
  ["mon"]=>
  int(10)
  ["year"]=>
  int(-1943)
  ["yday"]=>
  int(295)
  ["weekday"]=>
  string(7) "Unknown"
  ["month"]=>
  string(7) "October"
  [0]=>
  int(-123456789000)
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-30 07:26 UTC] sanjay dot mantoor at gmail dot com
Please download tests from 
http://www.4shared.com/file/68976901/6ce81c88/getdate.html

To recreate this bug, run following tests 
PHP53/getdate_variation7.phpt
PHP6/getdate_variation7.phpt
 [2009-05-03 15:12 UTC] derick@php.net
I found the bug, and have a fix... but was wondering why you think it should be a Monday. I calculate it as a Wednesday.
 [2009-05-11 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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC