0

I've a strange problem using SPOUT xlxs reader plugin. I get error

  Notice: Undefined offset: 19

In my test.xlsx at row 17. I don't know why. If I insert some text it is ok...but if it is empty I get error.....the strange thing is that all columns at index 19 before (1 <= row < 17) are empty but they doesn't get any error.

In attachment my test file: https://github.com/box/spout/files/4134401/test.zip

My code test:

include_once(dirname(dirname(__FILE__)) . "/vendors/spout/src/Spout/Autoloader/autoload.php");

use Box\Spout\Reader\Common\Creator\ReaderEntityFactory

$xlsx = ReaderEntityFactory::createReaderFromFile(dirname(__FILE__) . '/test.xlsx');

$xlsx->open(dirname(__FILE__) . '/test.xlsx');


foreach ($xlsx->getSheetIterator() as $sheet) {

    foreach ($sheet->getRowIterator() as $row) {

        $cells = $row->getCells();

        var_dump( $cells[18]->getValue() );
                var_dump( $cells[19]->getValue() ); //<---error offset 19 at row 17!!!!!!

    }

}
Giuseppe Lodi Rizzini
  • 1,045
  • 11
  • 33
  • It is not a "strange problem". People leave variables and indexes undefined all of the time. – Jay Blanchard Jan 30 '20 at 14:34
  • @jay Not correct, because my test files as 0-21 index columns...so 19 need to exist, please reopen post, it seems to a plugin bug – Giuseppe Lodi Rizzini Jan 30 '20 at 14:37
  • A plugin bug? One introduced by the author of the plugin? It is still an undefined index, so it shall stay closed. The earlier rows are likely not empty, they probably have an unprintable character. – Jay Blanchard Jan 30 '20 at 14:40

0 Answers0