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)
103103 ) {
104104 throw new PhpSpreadsheetException ('The table name can \'t be the same as a cell reference ' );
105105 }
106- if (!preg_match ('/^[A-Z_ \ \\\]/i ' , $ name )) {
106+ if (!preg_match ('/^[\p{L}_ \\\\ ]/iu ' , $ name )) {
107107 throw new PhpSpreadsheetException ('The table name must begin a name with a letter, an underscore character (_), or a backslash (\) ' );
108108 }
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 )) {
110110 throw new PhpSpreadsheetException ('The table name contains invalid characters ' );
111111 }
112112
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ public function validTableNamesProvider(): array
4242 ['_table_2 ' , '_table_2 ' ],
4343 ['\table_3 ' , '\table_3 ' ],
4444 [" Table_4 \n" , 'Table_4 ' ],
45+ ['table.5 ' , 'table.5 ' ],
46+ ['தமிழ் ' , 'தமிழ் ' ], // UTF-8 letters with combined character
4547 ];
4648 }
4749
@@ -72,6 +74,7 @@ public function invalidTableNamesProvider(): array
7274 ['R11C11 ' ],
7375 ['123 ' ],
7476 ['=Table ' ],
77+ ['ிக ' ], // starting with UTF-8 combined character
7578 [bin2hex (random_bytes (255 ))], // random string with length greater than 255
7679 ];
7780 }
You can’t perform that action at this time.
0 commit comments