Use the call to Coordinate::coordinateFromString() to validate the coordinate passed to createNewCell() _before_ we try adding it to the Collection
This commit is contained in:
parent
e3a6bc1e4c
commit
32559b44a3
|
|
@ -1336,12 +1336,12 @@ class Worksheet implements IComparable
|
|||
*/
|
||||
public function createNewCell($coordinate)
|
||||
{
|
||||
[$column, $row] = Coordinate::coordinateFromString($coordinate);
|
||||
$cell = new Cell(null, DataType::TYPE_NULL, $this);
|
||||
$this->cellCollection->add($coordinate, $cell);
|
||||
$this->cellCollectionIsSorted = false;
|
||||
|
||||
// Coordinates
|
||||
[$column, $row] = Coordinate::coordinateFromString($coordinate);
|
||||
$aIndexes = Coordinate::indexesFromString($coordinate);
|
||||
if ($this->cachedHighestColumn < $aIndexes[0]) {
|
||||
$this->cachedHighestColumn = $aIndexes[0];
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class WorksheetNamedRangesTest extends TestCase
|
|||
$namedCell = 'GOODBYE';
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
// $this->expectExceptionMessage("Invalid cell coordinate {$namedCell}");
|
||||
$this->expectExceptionMessage("Invalid cell coordinate {$namedCell}");
|
||||
|
||||
$worksheet = $this->spreadsheet->getActiveSheet();
|
||||
$worksheet->getCell($namedCell);
|
||||
|
|
@ -84,7 +84,7 @@ class WorksheetNamedRangesTest extends TestCase
|
|||
$ucNamedCell = strtoupper($namedCell);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
// $this->expectExceptionMessage("Invalid cell coordinate {$ucNamedCell}");
|
||||
$this->expectExceptionMessage("Invalid cell coordinate {$ucNamedCell}");
|
||||
|
||||
$worksheet = $this->spreadsheet->getActiveSheet();
|
||||
$worksheet->getCell($namedCell);
|
||||
|
|
|
|||
Loading…
Reference in New Issue