php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48149 Cannot make interval parts larger than 9999
Submitted: 2009-05-04 21:20 UTC Modified: 2009-05-05 13:57 UTC
From: lists at reptiliannature dot org Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.3, 6CVS (2009-05-05) 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: lists at reptiliannature dot org
New email:
PHP Version: OS:

 

 [2009-05-04 21:20 UTC] lists at reptiliannature dot org
Description:
------------
This bug seems to be identical to http://bugs.php.net/bug.php?id=45545 which was marked closed.

It appears than when part of the interval is greater than 9999 the DateInterval throws an exception.

DateInterval::__construct(): Unknown or bad format (PT10000M);

This happens with years, days, hours, minutes, and seconds

Reproduce code:
---------------
$i = 900;
while ($i) {
        try {
                $di = new DateInterval('PT' . $i . 'M');
        }
        catch (exception $e) {
                var_dump($i);
                echo $e->getMessage();
                break;
        }
        $i++;
}

Expected result:
----------------
I would expect to have a DateInterval object with interval ('PT1000M') or greater.

Actual result:
--------------
DateInterval::__construct(): Unknown or bad format (PT10000M);

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-04 23:12 UTC] fa@php.net
Still present in 5.3.0RC2
 [2009-05-05 07:45 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Hah, I had fixed it in the parser, but not ran the regenerator to the .c file. Should be fixed in CVS now.
 [2009-05-05 13:57 UTC] lists at reptiliannature dot org
No problem thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 07:01:28 2024 UTC