Skip to content

Commit c09aec5

Browse files
committed
ext/mbstring: update UCD parser to accept characters with multiple properties
1 parent e7cc819 commit c09aec5

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ext/mbstring/ucgendat/ucgendat.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,22 @@ function parseSpecialCasing(UnicodeData $data, string $input) : void {
367367

368368
function parseDerivedCoreProperties(UnicodeData $data, string $input) : void {
369369
foreach (parseDataFile($input) as $fields) {
370-
if (count($fields) != 2) {
371-
throw new Exception("Line does not contain 2 fields");
370+
$fieldCount = count($fields);
371+
if ($fieldCount != 2 && $fieldCount !== 3) {
372+
throw new Exception("Line does not contain 2 or 3 fields");
372373
}
373374

374-
$property = $fields[1];
375-
if ($property != 'Cased' && $property != 'Case_Ignorable') {
375+
$usedProperties = ['Cased', 'Case_Ignorable'];
376+
if (isset($fields[2]) && in_array($fields[2], $usedProperties, true)) {
377+
$property = $fields[2];
378+
}
379+
elseif (!in_array($fields[1], $usedProperties, true)) {
376380
continue;
377381
}
382+
else{
383+
$property = $fields[1];
384+
}
385+
378386

379387
$range = explode('..', $fields[0]);
380388
if (count($range) == 2) {

0 commit comments

Comments
 (0)