diff --git a/UPGRADING b/UPGRADING index a3e1639a636aa..df41a87054492 100644 --- a/UPGRADING +++ b/UPGRADING @@ -281,8 +281,9 @@ PDO_SQLITE: . NumberFormatter::ROUND_TOWARD_ZERO and NumberFormatter::ROUND_AWAY_FROM_ZERO have been added as aliases for NumberFormatter::ROUND_DOWN and NumberFormatter::ROUND_UP to be consistent with the new PHP_ROUND_* modes. - RFC: https://wiki.php.net/rfc/new_rounding_modes_to_round_function + . NumberFormatter::ROUND_HALFODD added to complement existing + NumberFormatter::ROUND_HALFEVEN functionality. - MBString: . The behavior of mb_strcut is more consistent now on invalid UTF-8 and UTF-16 diff --git a/ext/intl/formatter/formatter.stub.php b/ext/intl/formatter/formatter.stub.php index 4e31b7dc22c01..20d9b25399547 100644 --- a/ext/intl/formatter/formatter.stub.php +++ b/ext/intl/formatter/formatter.stub.php @@ -50,6 +50,8 @@ class NumberFormatter public const int ROUND_AWAY_FROM_ZERO = UNKNOWN; /** @cvalue UNUM_ROUND_HALFEVEN */ public const int ROUND_HALFEVEN = UNKNOWN; + /** @cvalue UNUM_ROUND_HALF_ODD */ + public const int ROUND_HALFODD = UNKNOWN; /** @cvalue UNUM_ROUND_HALFDOWN */ public const int ROUND_HALFDOWN = UNKNOWN; /** @cvalue UNUM_ROUND_HALFUP */ diff --git a/ext/intl/formatter/formatter_arginfo.h b/ext/intl/formatter/formatter_arginfo.h index fc50aadeb9496..6fd60fb620afc 100644 --- a/ext/intl/formatter/formatter_arginfo.h +++ b/ext/intl/formatter/formatter_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5d5421c72894a77894872efdf060ec058d275c13 */ + * Stub hash: dcd5c897c37ec1e0729736dedada2a6aac4cb673 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_NumberFormatter___construct, 0, 0, 2) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 0) @@ -244,6 +244,12 @@ static zend_class_entry *register_class_NumberFormatter(void) zend_declare_typed_class_constant(class_entry, const_ROUND_HALFEVEN_name, &const_ROUND_HALFEVEN_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release(const_ROUND_HALFEVEN_name); + zval const_ROUND_HALFODD_value; + ZVAL_LONG(&const_ROUND_HALFODD_value, UNUM_ROUND_HALF_ODD); + zend_string *const_ROUND_HALFODD_name = zend_string_init_interned("ROUND_HALFODD", sizeof("ROUND_HALFODD") - 1, 1); + zend_declare_typed_class_constant(class_entry, const_ROUND_HALFODD_name, &const_ROUND_HALFODD_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); + zend_string_release(const_ROUND_HALFODD_name); + zval const_ROUND_HALFDOWN_value; ZVAL_LONG(&const_ROUND_HALFDOWN_value, UNUM_ROUND_HALFDOWN); zend_string *const_ROUND_HALFDOWN_name = zend_string_init_interned("ROUND_HALFDOWN", sizeof("ROUND_HALFDOWN") - 1, 1); diff --git a/ext/intl/tests/formatter/rounding_modes.phpt b/ext/intl/tests/formatter/rounding_modes.phpt index 9edde4ac7fbd6..2d622f5052789 100644 --- a/ext/intl/tests/formatter/rounding_modes.phpt +++ b/ext/intl/tests/formatter/rounding_modes.phpt @@ -13,6 +13,7 @@ var_dump(NumberFormatter::ROUND_TOWARD_ZERO); var_dump(NumberFormatter::ROUND_UP); var_dump(NumberFormatter::ROUND_AWAY_FROM_ZERO); var_dump(NumberFormatter::ROUND_HALFEVEN); +var_dump(NumberFormatter::ROUND_HALFODD); var_dump(NumberFormatter::ROUND_HALFDOWN); var_dump(NumberFormatter::ROUND_HALFUP); @@ -27,6 +28,7 @@ int(2) int(3) int(3) int(4) +int(8) int(5) int(6) bool(true)