PhpSpreadsheet
PhpSpreadsheet copied to clipboard
fix: Handle `null` value for `$plotGroupingType` in `writePlotGroup`
This is:
- [x] a bugfix
- [ ] additional unit tests
Checklist:
- [ ] Changes are covered by unit tests
- [ ] Changes are covered by existing unit tests
- [ ] New unit tests have been added
- [x] Code style is respected
- [ ] Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
- [ ] CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
- [ ] Documentation is updated as necessary
Why this change is needed?
Fixes #3975
Note that I am not aware enough about the internals to create a concise enough unit test (without relying on an external file), but I would happily use some guidance.
Sometimes our tests do need to rely on an external file. Do you have an input file which demonstrates the problem when you load and then try to save it? If so, we can use that to construct a unit test.
Sometimes our tests do need to rely on an external file. Do you have an input file which demonstrates the problem when you load and then try to save it? If so, we can use that to construct a unit test.
Yes I have such file in #3975: example_plot_grouping_type_null.xlsx
Thank you for the sample file. You are correct that your fix eliminates the exception; however, the file that is produced is corrupt (error message when Excel opens it). So your change needs something more. I will take a look, but it may take several days before I can get to it.
however, the file that is produced is corrupt (error message when Excel opens it).
Okay, so it looks like google sheet has an issue then.
So your change needs something more. I will take a look, but it may take several days before I can get to it.
No worries, I found this bug while investigating another one so I'm not facing it. I put some details in https://github.com/PHPOffice/PhpSpreadsheet/issues/3975 about my analysis of the issue.