Edit report at http://bugs.php.net/bug.php?id=53939&edit=1
ID: 53939
Comment by: igor at wiedler dot ch
Reported by: igor at wiedler dot ch
Summary: [intl] IntlDateFormatter::format fails to escape M
in "'y-'M"
Status: Open
Type: Bug
Package: *Languages/Translation
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
Perhaps also worth noting:
Script:
$fmt = new IntlDateFormatter('en' ,IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC', IntlDateFormatter::GREGORIAN ,"WTF 'y-'M");
var_dump($fmt->format(0));
$fmt = new IntlDateFormatter('en' ,IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC', IntlDateFormatter::GREGORIAN ,"n-'M");
var_dump($fmt->format(0));
Actual:
string(1) "0"
string(1) "-"
Expected:
string(1) "0T1 1970-1"
string(1) "n-1"
Previous Comments:
------------------------------------------------------------------------
[2011-02-06 17:42:28] igor at wiedler dot ch
Description:
------------
When calling IntlDateFormatter::format with the format "'y-'M-'d", it
fails to
escape the M properly. ' is the escape character of ICU's dateformat.
Test script:
---------------
<?php
$fmt = new IntlDateFormatter('en' ,IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC', IntlDateFormatter::GREGORIAN ,"M");
var_dump($fmt->format(0));
$fmt = new IntlDateFormatter('en' ,IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC', IntlDateFormatter::GREGORIAN ,"'M");
var_dump($fmt->format(0));
$fmt = new IntlDateFormatter('en' ,IntlDateFormatter::FULL,
IntlDateFormatter::FULL,
'UTC', IntlDateFormatter::GREGORIAN ,"'y-'M");
var_dump($fmt->format(0));
Expected result:
----------------
string(1) "1"
string(1) "M"
string(3) "y-M"
Actual result:
--------------
string(1) "1"
string(1) "M"
string(3) "y-1"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53939&edit=1