Skip to content

XLSX protected data not preserved in 1.18.0 #2301

@lionnel8

Description

@lionnel8

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?

Protected data is preserved and stays hidden like in version 1.17.1 and older.
1 17 1

What is the current behavior?

Protected data and hidden formulas become visible.
1 18 0

What are the steps to reproduce?

The source file only needs to be loaded and saved to break the protected data.

$srcFile = MAddPath(PrivateDocumentGlobal::getUploadFolderDisc(), self::$file);

$tmpFile = MAddPath($GLOBALS["web_root_disc"], "data/tmp", pathinfo(self::$file, PATHINFO_FILENAME) . "-prevyplneno." . pathinfo(self::$file, PATHINFO_EXTENSION));

$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($srcFile);

$writer = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->save($tmpFile);

Which versions of PhpSpreadsheet and PHP are affected?

PhpSpreadsheet 1.18.0 and PHP 7.4.14. Older versions of PhpSpreadsheet, which I have tested until 1.15.0, behave correctly.

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