|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74811 IntlException: Constructor failed
Submitted: 2017-06-25 11:19 UTC Modified: 2017-06-25 21:51 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mberchtold at gmail dot com Assigned: pollita (profile)
Status: Closed Package: intl (PECL)
PHP Version: 7.2.0alpha2 OS: Windows 10
Private report: No CVE-ID: None
 [2017-06-25 11:19 UTC] mberchtold at gmail dot com
Bug in IntlDateFormatter constructor

Test script:
new \IntlDateFormatter('en_US' /*\Locale::getDefault()*/, \IntlDateFormatter::FULL, \IntlDateFormatter::FULL);

Expected result:
no exception

Actual result:
IntlException: Constructor failed in 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-25 12:09 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2017-06-25 12:09 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2017-06-25 12:19 UTC] mberchtold at gmail dot com
-Status: Feedback +Status: Assigned
 [2017-06-25 12:19 UTC] mberchtold at gmail dot com
PHP does not crash, hence there is no backtrace. It is trivial to reproduce the bug with the provided sample code.
 [2017-06-25 12:29 UTC]
-Status: Assigned +Status: Open -Assigned To: cmb +Assigned To:
 [2017-06-25 12:29 UTC]
> It is trivial to reproduce the bug with the provided sample code.

I have not been able to reproduce the issue with PHP 7.2.0alpha2
on Windows, nor on Linux, see <>.
 [2017-06-25 12:35 UTC] mberchtold at gmail dot com
Are you testing with the 64-bit NTS version?

This is the error from the sample script:
[25-Jun-2017 12:34:17 utc] PHP Fatal error:  Uncaught IntlException: Constructor failed in C:\Downloads\test.php:3
Stack trace:
#0 C:\Downloads\test.php(3): IntlDateFormatter->__construct('en_US', 0, 0)
#1 {main}
  thrown in C:\Downloads\test.php on line 3
 [2017-06-25 18:11 UTC]
-Status: Open +Status: Feedback -Package: Date/time related +Package: intl
 [2017-06-25 18:11 UTC]
Works for me too. Does intl_get_error_message() return anything?
 [2017-06-25 18:22 UTC] mberchtold at gmail dot com
-Status: Feedback +Status: Open
 [2017-06-25 18:22 UTC] mberchtold at gmail dot com
datefmt_create: no such time zone: 'utc': U_ILLEGAL_ARGUMENT_ERROR

Looking at php.ini:
date.timezone = utc

Is 'utc' no longer a valid timezone?
 [2017-06-25 18:34 UTC] mberchtold at gmail dot com
It seems utc is case sensitive now:
date.timezone = UTC
-> no error

date.timezone = UTc
date.timezone = utc
-> exception
 [2017-06-25 21:29 UTC]
So then wrt this bug, it'd be "not a bug", since the issue seems to be ICU changing what they consider valid values for their data table.  It shouldn't be PHP's responsibility to remap those values.

HOWEVER, it certainly seems like we should raise a better error message since we clearly have more information available.
 [2017-06-25 21:51 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: pollita
 [2017-06-25 21:51 UTC]
Updated the exception message thrown to make this more clear.
Otherwise closing as "not a bug" per previous comment.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jul 31 08:01:24 2021 UTC