Skip to content

Commit 8060a85

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #78912: INTL Support for accounting format
2 parents aaa0a80 + 505cc77 commit 8060a85

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

ext/intl/formatter/formatter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ void formatter_register_constants( INIT_FUNC_ARGS )
4949
FORMATTER_EXPOSE_CLASS_CONST( DURATION );
5050
FORMATTER_EXPOSE_CLASS_CONST( PATTERN_RULEBASED );
5151
FORMATTER_EXPOSE_CLASS_CONST( IGNORE );
52-
52+
#if U_ICU_VERSION_MAJOR_NUM >= 53
53+
FORMATTER_EXPOSE_CLASS_CONST( CURRENCY_ACCOUNTING );
54+
#endif
5355
FORMATTER_EXPOSE_CUSTOM_CLASS_CONST( "DEFAULT_STYLE", UNUM_DEFAULT );
5456

5557
/* UNumberFormatRoundingMode */

ext/intl/tests/bug78912.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Request #78912 (INTL Support for accounting format)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('intl')) die('skip intl extension not available');
6+
if (version_compare(INTL_ICU_VERSION, '53.0') < 0) die('skip for ICU >= 53.0');
7+
?>
8+
--FILE--
9+
<?php
10+
$nf = new NumberFormatter('en_US', NumberFormatter::CURRENCY_ACCOUNTING);
11+
var_dump($nf->formatCurrency(-12345.67, 'USD'));
12+
?>
13+
--EXPECT--
14+
string(12) "($12,345.67)"

0 commit comments

Comments
 (0)