wintercms / wintercms/winter

Improve Winter\Storm\Filesystem\Zip error reporting

Open
#976 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accepted
Dominant language
PHP
Stars
1.5k
Forks
246
Avg merge
19h 2m
Merged PRs (30d)
7

Description

Package targeted

Storm Library

Description

The wrapper around the standard ZipArchive utility doesn't return a proper error code in case of a failure when extracting the archive. It only returns false which hides the underlying reason for the failure. One can argue whether it's a good approach or not to be verbose. On one hand the intended use cases may not need to know about what exactly happened, on the other hand there may be more clients of the wrapper who don't want to reinvent the wheel or extend the class (although it's not marked as final).

There's a compromise for this particular situation. All the existing clients only check for the response to not be a false one, which can be easily converted to a check like === true without breaking anything and giving other clients an option to see the root cause of the failure.

Will this change be backwards-compatible?

Yes, based on the known usages of the class.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Winter\Storm\Filesystem\Zip wrapper and its archive-extraction method, then inspect the existing usages that check for false. Confirm how ZipArchive exposes extraction failures and verify that successful extraction remains distinguishable from a failure while preserving the underlying error information.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
43/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.