php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE
Submitted: 2015-04-08 14:19 UTC Modified: -
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: lenhatanh86 at gmail dot com Assigned:
Status: Closed Package: intl (PECL)
PHP Version: 5.6.7 OS: MacOS
Private report: No CVE-ID: None
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:
35 - 20 = ?
Subscribe to this entry?

 
 [2015-04-08 14:19 UTC] lenhatanh86 at gmail dot com
Description:
------------
IntlDateFormatter formatObject returns wrong value when time style is NONE (-1) because the code at line 149 in ext/intl/dateformat/dateformat_format_object.cpp 

//there's no support for relative time in ICU yet
timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative);

We can check timeStyle first, if it is not NONE style, process it like above code.

New code

//there's no support for relative time in ICU yet
if (timeStyle != DateFormat::NONE) {
timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative);
}


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-02 20:45 UTC] ab@php.net
Automatic comment on behalf of lenhatanh86@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0112b64a346ef1c4b8b21b1cef712a587eee9aa7
Log: Fixed bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE
 [2016-06-02 20:45 UTC] ab@php.net
-Status: Open +Status: Closed
 [2016-07-20 11:30 UTC] davey@php.net
Automatic comment on behalf of lenhatanh86@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=0112b64a346ef1c4b8b21b1cef712a587eee9aa7
Log: Fixed bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 05:01:27 2024 UTC