com php-src: Fixed bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE: ext/intl/dateformat/dateformat
_format_object.cpp ext/intl/tests/bug69398. phpt

From: Date: Thu, 02 Jun 2016 20:40:27 +0000
Subject: com php-src: Fixed bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE: ext/intl/dateformat/dateformat
_format_object.cpp ext/intl/tests/bug69398. phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92283@lists.php.net to get a copy of this message
Commit: 0112b64a346ef1c4b8b21b1cef712a587eee9aa7 Author: Mic <lenhatanh86@gmail.com> Thu, 2 Jun 2016 22:37:44 +0200 Committer: Anatol Belski <ab@php.net> Thu, 2 Jun 2016 22:40:27 +0200 Parents: 527ddacd2084d5112ba849d55ed8532d133cbd97 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0112b64a346ef1c4b8b21b1cef712a587eee9aa7 Log: Fixed bug #69398 IntlDateFormatter formatObject returns wrong value when time style is NONE Bugs: https://bugs.php.net/69398 Changed paths: M ext/intl/dateformat/dateformat_format_object.cpp A ext/intl/tests/bug69398.phpt Diff: diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index accb27e..e96ebe8 100644 --- a/ext/intl/dateformat/dateformat_format_object.cpp +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -146,7 +146,9 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) } //there's no support for relative time in ICU yet - timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative); + if (timeStyle != DateFormat::NONE) { + timeStyle = (DateFormat::EStyle)(timeStyle & ~DateFormat::kRelative); + } zend_class_entry *instance_ce = Z_OBJCE_P(object); if (instanceof_function(instance_ce, Calendar_ce_ptr)) { diff --git a/ext/intl/tests/bug69398.phpt b/ext/intl/tests/bug69398.phpt new file mode 100644 index 0000000..ea7dbd5 --- /dev/null +++ b/ext/intl/tests/bug69398.phpt @@ -0,0 +1,22 @@ +--TEST-- +IntlDateFormatter::formatObject(): returns wrong value when time style is NONE. +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +<?php if (version_compare(INTL_ICU_VERSION, '50.1.2') < 0) die('skip for ICU >= 51.1.2'); ?> +--FILE-- +<?php +$millitimestamp = 1428133423941.0; // 14:43:43 April 04 2015 +$date = IntlCalendar::createInstance('Asia/Ho_Chi_Minh'); +$date->setTime($millitimestamp); +echo IntlDateFormatter::formatObject($date, array(IntlDateFormatter::SHORT, IntlDateFormatter::NONE), 'vi_VN'), "\n"; +echo IntlDateFormatter::formatObject ($date, array(IntlDateFormatter::SHORT, IntlDateFormatter::NONE), 'ko_KR'), "\n"; +?> +==DONE== + +--EXPECTF-- +04/04/2015 +15. 4. 4. +==DONE== + +

« previous php.cvs (#92283) next »