-
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
"!" characters in Worksheet title will make reference formulas crash #325
Comments
Relevant code lines seem to be: PhpSpreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php Lines 3462 to 3471 in 4635d39
|
Can confirm it will crash even wihtout saving like so: <?php
require __DIR__ . '/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setTitle('Title!a');
$sheet->fromArray([1, 2,'=SUM(A1:A2)']);
$sheet->getCell('C1')->getCalculatedValue(); |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Bug still present in latest release |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
I'm having this issue as well.
Exception: |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Would still be nice if somebody can come up with a PR for this issue |
…HPOffice#325 Bugfix: replace explode by "!" with special function, that extracts sheet name from reference
…s crash PHPOffice#325 Bugfix: replace explode by "!" with special function, that extracts sheet name from reference" This reverts commit b349ea3
…HPOffice#325 Bugfix: replace explode by "!" with special function, that extracts sheet name from reference
…HPOffice#325 add information to changelog
…as crash PHPOffice#325 adding unit test for Worksheet::extractSheetTitle
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
This is:
What is the expected behavior?
The calculation should be valid. The "!" needs to be added to
$invalidCharacters
or calculations needs to be updated to support exclamation mark characters in sheet titles.What is the current behavior?
Uncaught PhpOffice\PhpSpreadsheet\Calculation\Exception: Title!!C1 -> Cell coordinate can not be zero-length string
What are the steps to reproduce?
Which versions of PhpSpreadsheet and PHP are affected?
all
The text was updated successfully, but these errors were encountered: