Skip to content

Commit

Permalink
Add isset for all $this->mapCellXfIndex[$xfIndex]
Browse files Browse the repository at this point in the history
  • Loading branch information
saiat3 committed Aug 22, 2017
1 parent d2dca99 commit 3aef277
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Classes/PHPExcel/Reader/Excel5.php
Original file line number Diff line number Diff line change
Expand Up @@ -3654,7 +3654,7 @@ private function readRk()
$numValue = self::getIEEE754($rknum);

$cell = $this->phpSheet->getCell($columnString . ($row + 1));
if (!$this->readDataOnly) {
if (!$this->readDataOnly && isset($this->mapCellXfIndex[$xfIndex])) {
// add style information
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -3743,7 +3743,7 @@ private function readLabelSst()
}
}

if (!$this->readDataOnly && !$emptyCell) {
if (!$this->readDataOnly && !$emptyCell && isset($this->mapCellXfIndex[$xfIndex])) {
// add style information
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -3791,7 +3791,7 @@ private function readMulRk()
// offset: var; size: 4; RK value
$numValue = self::getIEEE754(self::getInt4d($recordData, $offset + 2));
$cell = $this->phpSheet->getCell($columnString . ($row + 1));
if (!$this->readDataOnly) {
if (!$this->readDataOnly && isset($this->mapCellXfIndex[$xfIndex])) {
// add style
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -3836,7 +3836,7 @@ private function readNumber()
$numValue = self::extractNumber(substr($recordData, 6, 8));

$cell = $this->phpSheet->getCell($columnString . ($row + 1));
if (!$this->readDataOnly) {
if (!$this->readDataOnly && isset($this->mapCellXfIndex[$xfIndex])) {
// add cell style
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -3945,7 +3945,7 @@ private function readFormula()
}

$cell = $this->phpSheet->getCell($columnString . ($row + 1));
if (!$this->readDataOnly) {
if (!$this->readDataOnly && isset($this->mapCellXfIndex[$xfIndex])) {
// add cell style
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -4085,7 +4085,7 @@ private function readBoolErr()
break;
}

if (!$this->readDataOnly) {
if (!$this->readDataOnly && isset($this->mapCellXfIndex[$xfIndex])) {
// add cell style
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -4124,7 +4124,9 @@ private function readMulBlank()
// Read cell?
if (($this->getReadFilter() !== null) && $this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
$xfIndex = self::getInt2d($recordData, 4 + 2 * $i);
$this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]);
if(isset($this->mapCellXfIndex[$xfIndex])){
$this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
}
}
}
Expand Down Expand Up @@ -4176,7 +4178,7 @@ private function readLabel()
$cell = $this->phpSheet->getCell($columnString . ($row + 1));
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);

if (!$this->readDataOnly) {
if (!$this->readDataOnly && isset($this->mapCellXfIndex[$xfIndex])) {
// add cell style
$cell->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
Expand Down Expand Up @@ -4209,7 +4211,7 @@ private function readBlank()
$xfIndex = self::getInt2d($recordData, 4);

// add style information
if (!$this->readDataOnly && $this->readEmptyCells) {
if (!$this->readDataOnly && $this->readEmptyCells && isset($this->mapCellXfIndex[$xfIndex])) {
$this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]);
}
}
Expand Down

0 comments on commit 3aef277

Please sign in to comment.