PHPOffice / PhpSpreadsheet

A pure PHP library for reading and writing spreadsheet files
https://phpspreadsheet.readthedocs.io
MIT License
13.34k stars 3.47k forks source link

Internal Error #1637

Open LoekvanKooten opened 4 years ago

LoekvanKooten commented 4 years ago

This is:

- [ ] a bug report

What is the expected behavior?

XLS file exports neatly.

What is the current behavior?

Export crashes halfway.

What are the steps to reproduce?

Export the file. $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); on Apache/2.4.41 (Win64) OpenSSL/1.1.1c PHP/7.3.12

First time I encounter this issue. Could it be memory-related?

Fatal error: Uncaught PhpOffice\PhpSpreadsheet\Calculation\Exception: Dialogs!AA2 -> internal error in C:\xampp\htdocs\ModernMT\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Cell\Cell.php:270 Stack trace: #0 C:\xampp\htdocs\ModernMT\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php(1113): PhpOffice\PhpSpreadsheet\Cell\Cell->getCalculatedValue() #1 C:\xampp\htdocs\ModernMT\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php(1183): PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet->writeCellFormula(Object(PhpOffice\PhpSpreadsheet\Shared\XMLWriter), '=IFERROR(__xlud...', Object(PhpOffice\PhpSpreadsheet\Cell\Cell)) #2 C:\xampp\htdocs\ModernMT\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Writer\Xlsx\Worksheet.php(1040): PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet->writeCell(Object(PhpOffice\PhpSpreadsheet\Shared\XMLWriter), Object(PhpOffice\PhpSpreadsheet\Worksheet\Worksheet), 'AA2', Array) #3 C:\xampp\htdocs\ModernMT\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsh in C:\xampp\htdocs\ModernMT\vendor\phpoffice\phpspreadsheet\src\PhpSpreadsheet\Cell\Cell.php on line 270

LoekvanKooten commented 4 years ago

Said cell (AA2) is empty and contains nothing special.

LoekvanKooten commented 4 years ago

Cause found. The cell did contain something after all: =ALS.FOUT(__xludf.DUMMYFUNCTION("UNIQUE(Z2:Z3373)");"") (ALS.FOUT is the Dutch equivalent for I think it's just IF.ERROR in English.)

I think this formula can be handled better than just an Internal Error?

Making the cell empty solved the issue.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue for you, please try to help by debugging it further and sharing your results. Thank you for your contributions.