Skip to content

$writer->save($location); causes Error 0: Call to a member function getTitle() on null. Only on 1.15 #1715

@aramsdale

Description

@aramsdale

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)

What is the expected behavior?

I am opening a XLSX file using:

$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); $template = $reader->load("../../templates/mediacontainer.xlsx");

Then attempting to write the file using:

$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($template); $writer->save($writelocation);

I upgraded to the latest version, and now receiving the error in the title. It is probably related to #1646

Prior to 1.15, it worked as expected. After 1.15, it throws this error. Downgrading resolves the issue.

What is the current behavior?

Currently, pre-1.15, it opens the file via the reader, does the changes, and saves it with the writer.

What are the steps to reproduce?

I can reproduce it, but I'm not sure if there is something specific about the XLSX file that I'm using that doesn't have a "title" that is throwing the getTitle function off, but it appears to only be present in the latest version.

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:

Which versions of PhpSpreadsheet and PHP are affected?

1.15+

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