-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in ReferenceHelper::duplicateStylesByRow() #4246
Comments
Fix PHPOffice#4246. This can cause an Exception in unusual circumstances.
Thank your for the analysis. As you can see, I have a PR. I am normally reluctant to backport bug fixes from master to earlier branches; it is just too complicated and too time-consuming. That being said, the fact that you found this bug in an earlier release might make a difference. So, let me ask a couple of questions. What is keeping you from Release 3? And, if you must stay on release 2, why 2.2.2, which has some security exposures, rather than 2.3.3, which has patched them? If I do backport the fix, it will definitely be to the 2.3.* branch, not 2.2.*. As for |
Thanks for your quick action and response. Honestly, we didn't check composer since after the summer holiday break and by that missed all the updates to PHPSpreadsheet since then. No need to backport anything for us, we should be able to upgrade to the latest version as soon as the PR is included. |
This is:
What is the current behavior?
When trying to insert a large amount of rows via
Worksheet::insertNewRowBefore()
it will throw an exception saying something likeInvalid cell coordinate AAAA1
. Tracing the issue via stack trace showed that there is a bug inReferenceHelper::duplicateStylesByRow()
:The portion where it calls
$worksheet->cellExists([$j, $i])
swaps the column and row numbers. It should be the other way around like$worksheet->cellExists([$i, $j])
because the iteration is over i=column and j=row.Maybe the bug comes from the similar function
ReferenceHelper::duplicateStylesByColumn()
where this exact same line exists but there it is correct because the iteration is over j=column and i=row.What are the steps to reproduce?
Tried to recreate a piece of sample code but did not get it done in a reasonable amount of time because it also depends on the Excel file and on the XfIndex (don't know what that is) of the cell. But the error is pretty obvious just looking at the code.
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Can't say.
Which versions of PhpSpreadsheet and PHP are affected?
Our version is 2.2.2, but looking at the code base at Github it is still present in the current version.
The text was updated successfully, but these errors were encountered: