php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63906 DateInterval::__construct throws undocumented Exception
Submitted: 2013-01-04 19:16 UTC Modified: 2013-04-27 10:58 UTC
From: matt dot patterson at bookit dot com Assigned: salathe (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2013-01-04 19:16 UTC] matt dot patterson at bookit dot com
Description:
------------
---
From manual page: http://www.php.net/dateinterval.construct#refsect1-dateinterval.construct-parameters
---

DateInterval::__construct() throws \Exception when an invalid format is supplied, but this exception is not documented anywhere in the PHP manual.


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

try {
    $di = new DateInterval('PTS'); // Or any other invalid format
} catch (Exception $e) {
    echo $e->getMessage();
}

/*
 * Prints:
 * DateInterval::__construct() [<a  href='dateinterval.--construct'>dateinterval.--construct</a>]:  Unknown or bad format (PTS)
 */


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-14 09:18 UTC] oaass@php.net
You can find documentation for Exception on http://php.net/class.exception
 [2013-01-14 09:19 UTC] oaass@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: oaass
 [2013-01-15 19:27 UTC] salathe@php.net
Re-opening. The bug here is that the DateInterval::construct() manual page has no 
Errors/Exceptions section.
 [2013-01-15 19:27 UTC] salathe@php.net
-Status: Closed +Status: Re-Opened -Assigned To: oaass +Assigned To:
 [2013-04-27 10:51 UTC] salathe@php.net
Automatic comment from SVN on behalf of salathe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=330157
Log: exception info for dateinterval::__construct() (doc #63906)
 [2013-04-27 10:58 UTC] salathe@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: salathe
 [2013-04-27 10:58 UTC] salathe@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 16:00:01 2026 UTC