xref: /PHP-8.0/ext/intl/tests/bug53512.phpt (revision f8d79582)
1--TEST--
2Bug #53512 (NumberFormatter::setSymbol crash on bogus $attr values)
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) die('skip');
5if (PHP_INT_SIZE != 8) die('skip 64-bit only');
6?>
7--FILE--
8<?php
9
10$badvals = array(4294901761, 2147483648, -2147483648, -1);
11
12foreach ($badvals as $val) {
13    $x = numfmt_create("en", NumberFormatter::PATTERN_DECIMAL);
14    var_dump(numfmt_set_symbol($x, $val, ""));
15    var_dump(intl_get_error_message());
16}
17
18?>
19--EXPECT--
20bool(false)
21string(65) "numfmt_set_symbol: invalid symbol value: U_ILLEGAL_ARGUMENT_ERROR"
22bool(false)
23string(65) "numfmt_set_symbol: invalid symbol value: U_ILLEGAL_ARGUMENT_ERROR"
24bool(false)
25string(65) "numfmt_set_symbol: invalid symbol value: U_ILLEGAL_ARGUMENT_ERROR"
26bool(false)
27string(65) "numfmt_set_symbol: invalid symbol value: U_ILLEGAL_ARGUMENT_ERROR"
28