Improve error handling in ArchiveExtractor by catching ValueError during zip archive closure
Some checks are pending
CI Pipeline / build (push) Waiting to run
CI Pipeline / test-install (push) Blocked by required conditions
CI Pipeline / upload-release (push) Blocked by required conditions

This commit is contained in:
netkas 2025-03-17 03:17:47 -04:00
parent ead20f7924
commit ccb1ef6971
Signed by: netkas
GPG key ID: 4D8629441B76E4CC
2 changed files with 13 additions and 2 deletions

View file

@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.1.7] - Ongoing
## [2.1.7] - 2025-03-17
This update introduces a quality of life improvement
@ -13,6 +13,9 @@ This update introduces a quality of life improvement
- Refactor variable names for consistency and clarity in ShutdownHandler and PackageWriter classes
- Improve error handling in ShutdownHandler by logging warnings for cleanup failures
### Fixed
- Fixed issue in ArchiveExctractor where close() may be called on a already closed resource
## [2.1.6] - 2024-10-29

View file

@ -29,6 +29,7 @@
use ncc\Utilities\Console;
use PharData;
use RuntimeException;
use ValueError;
use ZipArchive;
class ArchiveExtractor
@ -126,6 +127,13 @@
}
}
$zip_archive->close();
try
{
$zip_archive->close();
}
catch(ValueError $e)
{
Console::outWarning('An error occurred while closing the zip archive, ' . $e->getMessage());
}
}
}