|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-02-06 17:42 UTC] 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"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 18:00:01 2025 UTC |
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"