ID:               46417
 Updated by:       [email protected]
 Reported By:      sanjay dot mantoor at gmail dot com
-Status:           Assigned
+Status:           Feedback
 Bug Type:         Date/time related
 Operating System: * (64bit)
 PHP Version:      5CVS-2008-10-29 (snap)
 Assigned To:      derick
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2008-10-30 07:26:13] 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

------------------------------------------------------------------------

[2008-10-29 10:18:01] 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)
}



------------------------------------------------------------------------


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

Reply via email to