php.net |  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
Votes:1
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 + 27 = ?
Subscribe to this entry?

 
 [2017-06-25 11:19 UTC] mberchtold at gmail dot com
Description:
------------
Bug in IntlDateFormatter constructor

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


Expected result:
----------------
no exception

Actual result:
--------------
IntlException: Constructor failed in 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-25 12:09 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2017-06-25 12:09 UTC] cmb@php.net
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
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php 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] cmb@php.net
-Status: Assigned +Status: Open -Assigned To: cmb +Assigned To:
 [2017-06-25 12:29 UTC] cmb@php.net
> 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 <https://3v4l.org/SpvfG>.
 [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] requinix@php.net
-Status: Open +Status: Feedback -Package: Date/time related +Package: intl
 [2017-06-25 18:11 UTC] requinix@php.net
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
or
date.timezone = utc
-> exception
 [2017-06-25 21:29 UTC] pollita@php.net
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] pollita@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: pollita
 [2017-06-25 21:51 UTC] pollita@php.net
Updated the exception message thrown to make this more clear.
Otherwise closing as "not a bug" per previous comment.

https://github.com/php/php-src/commit/ecaf408d30af119c04c67bf99790655a1e818472
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC