Skip to content

Commit a8b6214

Browse files
authored
Merge branch 'master' into TextFunctions-ArrayToText
2 parents 4724c8f + 630d92f commit a8b6214

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2727
### Fixed
2828

2929
- Fully flatten an array [Issue #2955](https://github.com/PHPOffice/PhpSpreadsheet/issues/2955) [PR #2956](https://github.com/PHPOffice/PhpSpreadsheet/pull/2956)
30+
- cellExists() and getCell() methods should support UTF-8 named cells [Issue #2987](https://github.com/PHPOffice/PhpSpreadsheet/issues/2987) [PR #2988](https://github.com/PHPOffice/PhpSpreadsheet/pull/2988)
3031

3132
## 1.24.1 - 2022-07-18
3233

src/PhpSpreadsheet/Worksheet/Worksheet.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ private function getWorksheetAndCoordinate(string $coordinate): array
12651265
}
12661266
} elseif (
12671267
!preg_match('/^' . Calculation::CALCULATION_REGEXP_CELLREF . '$/i', $coordinate) &&
1268-
preg_match('/^' . Calculation::CALCULATION_REGEXP_DEFINEDNAME . '$/i', $coordinate)
1268+
preg_match('/^' . Calculation::CALCULATION_REGEXP_DEFINEDNAME . '$/iu', $coordinate)
12691269
) {
12701270
// Named range?
12711271
$namedRange = $this->validateNamedRange($coordinate, true);

tests/PhpSpreadsheetTests/Worksheet/WorksheetNamedRangesTest.php

+18
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ public function testCellExists(): void
2929
self::assertTrue($cellExists);
3030
}
3131

32+
public function testCellExistsUtf8(): void
33+
{
34+
$namedCell = 'Χαιρετισμός';
35+
36+
$worksheet = $this->spreadsheet->getActiveSheet();
37+
$cellExists = $worksheet->cellExists($namedCell);
38+
self::assertTrue($cellExists);
39+
}
40+
3241
public function testCellNotExists(): void
3342
{
3443
$namedCell = 'GOODBYE';
@@ -67,6 +76,15 @@ public function testGetCell(): void
6776
self::assertSame('Hello', $cell->getValue());
6877
}
6978

79+
public function testGetCellUtf8(): void
80+
{
81+
$namedCell = 'Χαιρετισμός';
82+
83+
$worksheet = $this->spreadsheet->getActiveSheet();
84+
$cell = $worksheet->getCell($namedCell);
85+
self::assertSame('नमस्ते', $cell->getValue());
86+
}
87+
7088
public function testGetCellNotExists(): void
7189
{
7290
$namedCell = 'GOODBYE';
455 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)