Skip to content
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

Fix for: "!" characters in Worksheet title will make reference formulas crash #325 #662

Merged
merged 4 commits into from
Oct 3, 2018

Conversation

gurrumpalad
Copy link
Contributor

@gurrumpalad gurrumpalad commented Sep 6, 2018

Bugfix: replace explode by "!" with special function, that extracts sheet name from reference

This is:

  • a bugfix

Checklist:

Why this change is needed?

When sheet title extracting from string reference (like "Work!sheet1!A1"), php function "explode" divide this string to three parts (['Work', 'sheet1', 'A1']). And then these wrong values using in formulas, ranges, etc.
This change fix that problem by using special function Worksheet::extractSheetTitle (this function also has been changed to make sure that worksheet title can contain "!" character). So, that function search last position of "!" in reference string and divide it to 2 parts correctly (['Work!sheet1', 'A1']).

bayzhanov added 2 commits September 6, 2018 16:49
…HPOffice#325

 Bugfix: replace explode by "!" with special function, that extracts sheet name from reference
Copy link
Member

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks interesting. Could you please add unit tests for it ?

bayzhanov and others added 2 commits October 2, 2018 14:49
@PowerKiKi PowerKiKi merged commit 50a9bc8 into PHPOffice:develop Oct 3, 2018
@PowerKiKi
Copy link
Member

Thanks !

Dfred pushed a commit to Dfred/PhpSpreadsheet that referenced this pull request Nov 20, 2018
When extracting sheet title from string reference (like `"Work!sheet1!A1"`), PHP function `explode()` divide this string into three parts: `['Work', 'sheet1', 'A1']`. And then these wrong values are used in formulas, ranges, etc.

This change fix that problem by using special function `Worksheet::extractSheetTitle()`. This function also has been changed to make sure that worksheet title can contain "!" character. So, that function search last position of "!" in reference string and divide it to 2 parts correctly: `['Work!sheet1', 'A1']`.

Fixes PHPOffice#325
Fixes PHPOffice#662
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants