Skip to content

Undefined index with IReader::load method #1655

@kalyabin

Description

@kalyabin

This is:

- [ *] 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)

What is the expected behavior?

Got exception when create Spreadsheet instance using IReader::load method:

[2020-09-22 22:43:37] local.ERROR: Undefined index: rId7 {"exception":"[object] (ErrorException(code: 0): Undefined index: rId7 at /var/www/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php:44)
[stacktrace]
#0 /var/www/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php(44): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8, 'Undefined index...', '/var/www/vendor...', 44, Array)
#1 /var/www/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php(32): PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Hyperlinks->setHyperlink(Object(SimpleXMLElement), Object(PhpOffice\\PhpSpreadsheet\\Worksheet\\Worksheet))
#2 /var/www/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php(820): PhpOffice\\PhpSpreadsheet\\Reader\\Xlsx\\Hyperlinks->setHyperlinks(Object(SimpleXMLElement))
...

xlsx file is valid and currently opened.

What is the current behavior?

Correctly created Spreadsheet instance.

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';

$reader = IOFactory::createReaderForFile('path/to/file.xlsx');

$spreadsheet = $reader->load('path/to/file.xlsx');

Which versions of PhpSpreadsheet and PHP are affected?

1.14.1

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