php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55687 DateTime "Unknown" day of week
Submitted: 2011-09-13 20:54 UTC Modified: 2015-01-20 21:24 UTC
From: salathe@php.net Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: trunk-SVN-2011-09-13 (SVN) OS:
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: salathe@php.net
New email:
PHP Version: OS:

 

 [2011-09-13 20:54 UTC] salathe@php.net
Description:
------------
For lots of negative-year dates, the day of the week is reported as "Unknown". 
Sundays (0th day) are okay. The most modern date affected appears to be -0007-10-
01.

The test script below runs through each day in the year -10 as an example.

Test script:
---------------
<?php

$utc = new DateTimeZone('UTC');
$period = new DatePeriod(
    new DateTime('-0010-01-01', $utc),
    new DateInterval('P1D'),
    new DateTime('-0009-01-01', $utc)
);

foreach ($period as $date) {
    if ($date->format('D') === 'Unknown') {
        echo $date->format('Y-m-d D') . PHP_EOL;
    }
}

?>

Expected result:
----------------
No output is expected.

Actual result:
--------------
-0010-01-01 Unknown
-0010-01-02 Unknown
-0010-01-03 Unknown
-0010-01-04 Unknown
-0010-01-05 Unknown
-0010-02-01 Unknown
-0010-02-02 Unknown
-0010-03-01 Unknown
-0010-03-02 Unknown
-0010-05-01 Unknown
-0010-05-02 Unknown
-0010-05-03 Unknown
-0010-05-04 Unknown
-0010-06-01 Unknown
-0010-08-01 Unknown
-0010-08-02 Unknown
-0010-08-03 Unknown
-0010-10-01 Unknown
-0010-10-02 Unknown
-0010-10-03 Unknown
-0010-10-04 Unknown
-0010-10-05 Unknown
-0010-11-01 Unknown
-0010-11-02 Unknown

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-13 20:54 UTC] salathe@php.net
-Assigned To: +Assigned To: derick
 [2015-01-20 21:24 UTC] derick@php.net
-Status: Assigned +Status: Not a bug
 [2015-01-20 21:24 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

This is fixed in PHp 5.5 (at least 5.5.21-dev).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC