xref: /PHP-8.0/ext/intl/tests/bug70452.phpt (revision f7600e17)
1--TEST--
2Bug #70452 string IntlChar::charName() can sometimes return bool(false)
3--SKIPIF--
4<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
5--FILE--
6<?php
7// Rely on the default value for the second parameter
8var_dump(IntlChar::charName("A"));
9// Provide a valid option for the second parameter
10var_dump(IntlChar::charName("A", IntlChar::UNICODE_CHAR_NAME));
11// Another valid option, but with no corresponding name for that given option
12// This properly returns an empty string, as expected
13var_dump(IntlChar::charName("A", IntlChar::UNICODE_10_CHAR_NAME));
14// Provide an invalid value for the second parameter
15var_dump(IntlChar::charName("A", 12345));
16?>
17--EXPECT--
18string(22) "LATIN CAPITAL LETTER A"
19string(22) "LATIN CAPITAL LETTER A"
20string(0) ""
21NULL
22