File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
src/PhpSpreadsheet/Worksheet
tests/PhpSpreadsheetTests/Worksheet/Table Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -103,10 +103,10 @@ public function setName(string $name)
103
103
) {
104
104
throw new PhpSpreadsheetException ('The table name can \'t be the same as a cell reference ' );
105
105
}
106
- if (!preg_match ('/^[A-Z_ \ \\\]/i ' , $ name )) {
106
+ if (!preg_match ('/^[\p{L}_ \\\\ ]/iu ' , $ name )) {
107
107
throw new PhpSpreadsheetException ('The table name must begin a name with a letter, an underscore character (_), or a backslash (\) ' );
108
108
}
109
- if (!preg_match ('/^[A-Z_ \ \\\][A-Z0- 9\._]+$/i ' , $ name )) {
109
+ if (!preg_match ('/^[\p{L}_ \\\\ ][\p{L}\p{M}0- 9\._]+$/iu ' , $ name )) {
110
110
throw new PhpSpreadsheetException ('The table name contains invalid characters ' );
111
111
}
112
112
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ public function validTableNamesProvider(): array
42
42
['_table_2 ' , '_table_2 ' ],
43
43
['\table_3 ' , '\table_3 ' ],
44
44
[" Table_4 \n" , 'Table_4 ' ],
45
+ ['table.5 ' , 'table.5 ' ],
46
+ ['தமிழ் ' , 'தமிழ் ' ], // UTF-8 letters with combined character
45
47
];
46
48
}
47
49
@@ -72,6 +74,7 @@ public function invalidTableNamesProvider(): array
72
74
['R11C11 ' ],
73
75
['123 ' ],
74
76
['=Table ' ],
77
+ ['ிக ' ], // starting with UTF-8 combined character
75
78
[bin2hex (random_bytes (255 ))], // random string with length greater than 255
76
79
];
77
80
}
You can’t perform that action at this time.
0 commit comments