xref: /PHP-7.4/ext/intl/tests/bug14562.phpt (revision 6c8a570a)
1--TEST--
2Bug #14562 NumberFormatter breaks when locale changes
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7
8function ut_main()
9{
10	$res_str = "";
11	$de_locale="de_DE.UTF-8";
12	$fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
13	$numeric = $fmt->parse("1234,56");
14	$res_str .= "$numeric\n";
15	setlocale(LC_ALL, $de_locale);
16	$fmt = new NumberFormatter("de", NumberFormatter::DECIMAL );
17	$numeric = $fmt->parse("1234,56");
18	setlocale(LC_ALL, "C"); // reset for printing
19	$res_str .= "$numeric\n";
20    	return $res_str;
21}
22
23include_once( 'ut_common.inc' );
24ut_run();
25
26?>
27--EXPECT--
281234.56
291234.56
30