1--TEST-- 2normalizer_get_raw_decomposition() 3--SKIPIF-- 4<?php if( !extension_loaded( 'intl' ) ) print 'skip intl extension not loaded'; ?> 5<?php if( !function_exists( 'normalizer_get_raw_decomposition' ) ) print 'skip normalizer_get_raw_decomposition function does not exist'; ?> 6--FILE-- 7<?php 8 9/* 10 * Try getting raw decomposition mappings 11 * with procedural and class methods. 12 */ 13 14function ut_main() 15{ 16 $result = ''; 17 $strings = [ 18 "a", 19 "\u{FFDA}", 20 "\u{FDFA}", 21 "", 22 "aa", 23 "\xF5", 24 ]; 25 26 foreach ($strings as $string) { 27 $decomposition = ut_norm_get_raw_decomposition($string, Normalizer::FORM_KC); 28 $error_code = intl_get_error_code(); 29 $error_message = intl_get_error_message(); 30 31 $string_hex = bin2hex($string); 32 $result .= "---------------------\n"; 33 34 if ($decomposition === null) { 35 $result .= "'$string_hex' has no decomposition mapping\n" ; 36 } else { 37 $result .= "'$string_hex' has the decomposition mapping '" . bin2hex($decomposition) . "'\n" ; 38 } 39 $result .= "error info: '$error_message' ($error_code)\n"; 40 } 41 42 return $result; 43} 44 45include_once( 'ut_common.inc' ); 46ut_run(); 47 48?> 49--EXPECT-- 50--------------------- 51'61' has no decomposition mapping 52error info: 'U_ZERO_ERROR' (0) 53--------------------- 54'efbf9a' has the decomposition mapping 'e385a1' 55error info: 'U_ZERO_ERROR' (0) 56--------------------- 57'efb7ba' has the decomposition mapping 'd8b5d984d98920d8a7d984d984d98720d8b9d984d98ad98720d988d8b3d984d985' 58error info: 'U_ZERO_ERROR' (0) 59--------------------- 60'' has no decomposition mapping 61error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1) 62--------------------- 63'6161' has no decomposition mapping 64error info: 'Input string must be exactly one UTF-8 encoded code point long.: U_ILLEGAL_ARGUMENT_ERROR' (1) 65--------------------- 66'f5' has no decomposition mapping 67error info: 'Code point out of range: U_ILLEGAL_ARGUMENT_ERROR' (1) 68