-
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
Update ReferenceHelper.php #1873
Update ReferenceHelper.php #1873
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for identifying this problem, and for the resolution
@@ -608,7 +608,12 @@ public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pShee | |||
// Update workbook: define names | |||
if (count($pSheet->getParent()->getDefinedNames()) > 0) { | |||
foreach ($pSheet->getParent()->getDefinedNames() as $definedName) { | |||
if ($definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) { | |||
$hash = null; | |||
if ($definedName->getWorksheet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the sake of readability, can you do an explicit comparison for not null)..
This is something that I've been doing in all the code that I've been working with recently, and it does make the if comparison a lot more explicit rather than relying on the loose typed truthiness/falsiness of PHP
@@ -608,7 +608,7 @@ public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pShee | |||
// Update workbook: define names | |||
if (count($pSheet->getParent()->getDefinedNames()) > 0) { | |||
foreach ($pSheet->getParent()->getDefinedNames() as $definedName) { | |||
if ($definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) { | |||
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarkBaker does this make sense?
I don't think updateCellReference should be called on a null worksheet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes perfect sense. thanks for the quick update
@@ -608,7 +608,7 @@ public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pShee | |||
// Update workbook: define names | |||
if (count($pSheet->getParent()->getDefinedNames()) > 0) { | |||
foreach ($pSheet->getParent()->getDefinedNames() as $definedName) { | |||
if ($definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) { | |||
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes perfect sense. thanks for the quick update
This is:
Checklist:
Why this change is needed?
Fixes issue #1872