php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74226 IntlDateFormatter returns different patterns in different environments
Submitted: 2017-03-08 20:04 UTC Modified: 2018-05-03 17:07 UTC
From: okopylova at magento dot com Assigned:
Status: Not a bug Package: intl (PECL)
PHP Version: 5.6.30 OS: Linux/Mac
Private report: No CVE-ID: None
 [2017-03-08 20:04 UTC] okopylova at magento dot com
Description:
------------
\IntlDateFormatter::getPattern() returns different pattern for Mac homebrew php56 + php56-intl and Amazon Linux 2015.09: php56 + php56-intl.



Test script:
---------------
$t = (new \IntlDateFormatter(
   'ja_JP',
   \IntlDateFormatter::MEDIUM,
   \IntlDateFormatter::NONE
))->getPattern();
 
 
echo $t, PHP_EOL;


Expected result:
----------------
The result should be the same on different OS.
I'm not sure which result is the correct one, but I think it's 'yyyy/MM/dd', as http://demo.icu-project.org/icu-bin/locexp?d_=en&_=ja_JP provides '2017/03/08' as an example of medium date format.

Actual result:
--------------
Mac homebrew php56 + php56-intl result: y/MM/dd
Amazon Linux 2015.09: php56 + php56-intl result: yyyy/MM/dd

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-18 18:20 UTC] devel at jasonwoods dot me dot uk
I am additionally see this issue across environments. Between ArchLinux, OSX and RedHat.

It seems that the difference occurs between ICU Data versions. So later ICU data versions return "dd/MM/y" for en_GB for example, but for older ICU "dd/MM/yyyy"

For me, the older ICU are:
ICU version => 50.1.2
ICU Data version => 50.1

And the newer are:
ICU version => 59.1
ICU Data version => 59.1
and
ICU version => 60.0
ICU Data version => 60.0

So this seems to be intentional behaviour depending on the ICU data available on the system.
 [2018-05-03 17:07 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2018-05-03 17:07 UTC] ab@php.net
The triage of @devel at jasonwoods dot me dot uk is correct. Changes in the ICU data is not a bug.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC