Ask questionsPhpSpreadsheet can't load xlsx files created by itself

This is:

- [X] a bug report

The package is unable to load xlsx files created by itself with fatal error. There is no issue loading files created by Google Sheets (I don't have MS Office installed). The test.xlsx file was created by Google Sheets.

Test script

// test.php
include 'vendor/autoload.php';
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('test.xlsx');
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx");
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('output.xlsx');

What is the expected behavior?

Excel file loaded into the $preadsheet variable

What is the current behavior?

Fatal error: Uncaught Error: Call to a member function children() on bool in C:\...\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Reader\Xlsx.php:1633
Stack trace:
#0 C:\...\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\IOFactory.php(95): PhpOffice\PhpSpreadsheet\Reader\Xlsx->load('out.xlsx')
#1 C:\...\test.php(7): PhpOffice\PhpSpreadsheet\IOFactory::load('out.xlsx')
#2 {main}
  thrown in C:\...\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Reader\Xlsx.php on line 1633

Which versions of PhpSpreadsheet and PHP are affected?

PHP 7.3.1 PhpSpreadsheet 1.6.0

Edit: If I comment everything related to reading drawings everything works fine.


Answer questions AlexPravdin

This also cause an error message when opening the result file in MS Excel, but it is recoverable.

Github User Rank List