BIFF8 E_NOTICE undefined offset fix#1354
Conversation
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
src/PhpSpreadsheet/Reader/Xls.php
Outdated
| $zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10); | ||
| if ($zoomscaleInPageBreakPreview === 0) { | ||
| $zoomscaleInPageBreakPreview = 60; | ||
| if (isset($recordData[10]) && ($zoomscaleInPageBreakPreview = self::getUInt2d($recordData, 10)) === 0) { |
There was a problem hiding this comment.
Please avoid having assignment in condition and squash all the commit into one.
PowerKiKi
left a comment
There was a problem hiding this comment.
Please avoid having assignment in condition and squash all the commit into one.
PowerKiKi
left a comment
There was a problem hiding this comment.
Please avoid having assignment in condition and squash all the commit into one.
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
|
@PowerKiKi I remember we actually had the assignments outside of the the condition before but it failed the cyclomatic complexity check. To prevent having to do a larger refactoring we decided to move the assignment into the condition, epecially since this is only a small fix preventing a notice. If you really think it's necessary we will of course try to find a solution acceptable for everyone, please let me and @aternowy know how to proceed. |
|
The best would be to refactor, but if we cannot do that, we should at least avoid assignment in if condition and accept a cyclomatic complexity check fail. |
|
@PowerKiKi thank you for response, we will add fix to this PR ASAP |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
427b62e to
d4fda28
Compare
6515cbd to
c0f89b9
Compare
|
@PowerKiKi i finally got around to this. I have removed the assignments in the conditions which now causes the cyclomatic complexity problem as I said before. |
Sheet View Settings Block should be 8-14 bytes long in BIFF8 Excel 97 according to the open office file format documentation. However access to byte 10 and 12 is not possible when record data is malformed, so getUInt2d throws notice.
e76fa86 to
c40c47b
Compare
This is:
Checklist:
Why this change is needed?
Sheet View Settings Block should be 8-14 bytes long in BIFF8 Excel 97 according to the open office file format documentation. However access to byte 10 and 12 is not possible when record data is malformed, so

getUInt2dthrows notice.Summary
Test access to byte offsets for "cached magnification factor" before using it. Use default values otherwise to avoid notices