PhpSpreadsheet
                                
                                
                                
                                    PhpSpreadsheet copied to clipboard
                            
                            
                            
                        Undefined array key with $sharedStrings when upload file excel
This is:
- [x] a bug report
https://github.com/PHPOffice/PhpSpreadsheet/blob/f17e16653dbcdc7177efc91deb1f87a5faa096b5/src/PhpSpreadsheet/Reader/Xlsx.php#L850
What is the expected behavior?
Don't call an element when the element is undefined. Do you know what is the cause of this error?
What is the current behavior?
I don't know what causes this error. An exception error occurred:
Undefined array key 1604 {"exception":"[object] (ErrorException(code: 0): Undefined array key 1604 at /var/www/html/publisher_web/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php:850
What are the steps to reproduce?
Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:
<?php
require __DIR__ . '/vendor/autoload.php';
// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
// add code that show the issue here...
If this is an issue with reading a specific spreadsheet file, then it may be appropriate to provide a sample file that demonstrates the problem; but please keep it as small as possible, and sanitize any confidential information before uploading.
What features do you think are causing the issue
- [x] Reader
 - [ ] Writer
 - [ ] Styles
 - [ ] Data Validations
 - [ ] Formula Calculations
 - [ ] Charts
 - [ ] AutoFilter
 - [ ] Form Elements
 
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Which versions of PhpSpreadsheet and PHP are affected?
Please upload the spreadsheet that causes this problem. Without it, there is no chance of debugging it.
112579-promediapostlogswk2-12.xlsx
I'm getting it with this file
$inputFileType = IOFactory::identify($file_name);
$objReader = IOFactory::createReader($inputFileType);
$objReader->setReadDataOnly(false);
$objExcel = $objReader->load($file_name); // tons of warnings.... example: PHP Warning:  Undefined array key 1153 in .../vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php on line 839
also it doesn't seem to read most of the cell data either. cell data types are null.
Thank you for the sample file. This is another case of unexpected absolute addressing in a rels file. Expect a PR in a day or two.
FWIW i tried reading that file with a python (openpyxl) and this was thrown "There is no item named 'xl/sharedStrings.xml' in the archive"
Thank you for the info on openpyxl - I hope you have opened an issue with them as well. In the meantime, please test against PR 3923 if you can.