Skip to content

SimpleXML warning when reading a spreadsheet #2542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blackwolf12333 opened this issue Feb 1, 2022 · 0 comments · Fixed by #2550
Closed

SimpleXML warning when reading a spreadsheet #2542

blackwolf12333 opened this issue Feb 1, 2022 · 0 comments · Fixed by #2550

Comments

@blackwolf12333
Copy link

blackwolf12333 commented Feb 1, 2022

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.

oleibman added a commit to oleibman/PhpSpreadsheet that referenced this issue Feb 3, 2022
Fix PHPOffice#2542. Xlsx Reader is expecting a `sz` tag when reading RichText, but it is not required, and PhpSpreadsheet issues a warning message when it is missing.
oleibman added a commit that referenced this issue Feb 12, 2022
Fix #2542. Xlsx Reader is expecting a `sz` tag when reading RichText, but it is not required, and PhpSpreadsheet issues a warning message when it is missing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant