Skip to content

SimpleXML warning when reading a spreadsheet #2542

@blackwolf12333

Description

@blackwolf12333

This is:

- [x] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

This is blocking us from updating to the latest version.

What is the expected behavior?

PhpSpreadsheet does not generate warnings, phpunit errors on the warning.

What is the current behavior?

PhpSpreadsheet throws a warning in a phpunit test, I've created a reproducer below as well.


( ! )  Warning: PhpOffice\PhpSpreadsheet\Reader\Xlsx::parseRichText(): Node no  longer exists in  /var/www/html/latest/include/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php  on line 1684
--


1 | 0.0072 | 389536 | {main}(  ) | .../crash.php:0
2 | 0.1378 | 495560 | PhpOffice\PhpSpreadsheet\Reader\Xlsx->load( $filename = '/var/www/html/latest/../tests/fixtures/import/import_with_empty_rows.xlsx', $flags = ??? ) | .../crash.php:18
3 | 3.6902 | 1331304 | PhpOffice\PhpSpreadsheet\Reader\Xlsx->parseRichText( $is = class SimpleXMLElement { public $r = [0 => class SimpleXMLElement { ... }, 1 => class SimpleXMLElement { ... }] } ) | .../Xlsx.php:497

</font>

What are the steps to reproduce?

Please use the attached file.

<?php

use PhpOffice\PhpSpreadsheet\IOFactory;

require __DIR__ . '/vendor/autoload.php';

$sLocalPath = 'path/to/import_with_empty_rows.xlsx';
$sSpreadsheetType = IOFactory::identify($sLocalPath);

$oReader = IOFactory::createReader($sSpreadsheetType);
$oReader->setReadFilter(new class() implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter {

	public function readCell($columnAddress, $row, $worksheetName = '') {
		return $columnAddress <= 65;
	}
});

$oSheet = $oReader->load($sLocalPath);

import_with_empty_rows.xlsx

Which versions of PhpSpreadsheet and PHP are affected?

One of my tests failed after I updated from 1.18 to 1.19. Version 1.21 is also affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions