Fix SevenZip::reset() to also reset formatFlags#47
Conversation
When `reset()` was called, it cleared `$this->format` (causing `getFormat()` to return the default `7z`), but failed to reset `$this->formatFlags`. This resulted in subsequent operations attempting to build `7z` archives using flags from the previously set format (e.g., `-tzip`), causing failures and invalid archives. This commit fixes the bug by calling `setFormatFlags()` inside `reset()` and adds a test for it. Co-authored-by: insign <1113045+insign@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This PR addresses a bug where
SevenZip::reset()failed to reset$this->formatFlags.When
reset()was called, it correctly cleared$this->format(so thatgetFormat()would return the default'7z'), but left$this->formatFlagsunchanged. As a result, subsequent operations would attempt to build a'7z'archive but use compression flags from the previously configured format (e.g.,-tzip), causing 7-Zip executions to fail with invalid archive errors.The fix calls
setFormatFlags()inside thereset()method to ensure flags correctly align with the reset format. A test case was also added to ensure this behavior is verified in the suite. No.mdfiles were changed as none were impacted by this fix. All pre-commit checks pass and no dummy test files are leaked.PR created automatically by Jules for task 2340808107410579736 started by @insign