Fix: AfterChunk event raised after sheet disconnect#4385
Open
zigzagdev wants to merge 12 commits into
Open
Conversation
… table (SpartnerNL#4325) Co-authored-by: Zakaria Amirou <zakaria.amirou@cynapsis.de>
…nsistency (SpartnerNL#4330) * Fix: correct TSV constant value and update parameter name in store method * Fix: update TSV constant value, add file path parameter to WriterFactory, and implement TSV file detection logic * style: format code in WriterFactory for consistency
* feat: Update composer.json for Laravel 13 support * update CI * try to run on testbench 10 * exclude php 8.2 on L13 * testbench 11 * testbench 11 in composer.json * scout 11 in composer.json * scout 11 in ci * wip * try W
* suppress error from mkdir * test --------- Co-authored-by: lukekuzmish <lukekuzmish@loopreturns.com>
Member
|
can you retarget this to 4.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1️⃣Why should it be added? What are the benefits of this change?
AfterChunkwas fired afterSheet::disconnect()inReadChunk::handle().disconnect()callsunset($this->worksheet), so any event handler that accesses$event->getSheet()->getDelegate()would encounter an undefined property and receivenullinstead of the expectedWorksheetinstance.Moving
raise(AfterChunk)beforedisconnect()ensures the worksheet is still accessible inside event handlers, which is the naturally expected behavior.2️⃣Does it contain multiple, unrelated changes?
No.
This PR contains a single focused fix: reordering
raise(AfterChunk)anddisconnect()inReadChunk::handle().3️⃣Does it include tests, if possible?
Yes.
test_after_chunk_event_sheet_delegate_is_accessiblehas been added toWithEventsTest, asserting that$event->getSheet()->getDelegate()returns aWorksheetinstance within anAfterChunkhandler.4️⃣Any drawbacks? Possible breaking changes?
No breaking changes.
The fix only corrects the order of two operations. Event handlers that do not access
getDelegate()are unaffected.5️⃣Tasks
Test Results