|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64469 Constructing a DateTimeZone object with an invalid tz name emits a hidden error
Submitted: 2013-03-20 16:40 UTC Modified: 2013-03-22 04:08 UTC
From: evert at rooftopsolutions dot nl Assigned:
Status: Not a bug Package: date_time (PECL)
PHP Version: 5.4.13 OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: evert at rooftopsolutions dot nl
New email:
PHP Version: OS:


 [2013-03-20 16:40 UTC] evert at rooftopsolutions dot nl
When creating a new DateTimeZone with an invalid tz name, the documentation states that it will emit an exception.

This happens, however.. a notice is also emitted, although not immediately visible. This notice pops its head up when calling error_get_last().

Test script:
php -d error_reporting=-1 -d display_errors=1  -r ' try { @new DateTimeZone("YOUR MOM"); } catch (Exception $e) {} print_r( error_get_last() ); ';

Expected result:

Actual result:
    [type] => 2
    [message] => DateTimeZone::__construct(): Unknown or bad timezone (YOUR MOM)
    [file] => Command line code
    [line] => 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-03-22 04:08 UTC]
-Status: Open +Status: Not a bug
 [2013-03-22 04:08 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Date ext use EH_THROW as a error callback to trigger exceptions.

that means, it first is an error, then bubble up in exception form.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed May 12 03:01:24 2021 UTC