Add neutral diagnostic framework for future reporting modules: - DiagnosticReporterInterface, Registry, Manager, PayloadSanitizer - Laravel exception hook in bootstrap/app.php - Module permission declarations (requires_permissions in module.json) - Core diagnostic report points (module boot/install/update failures) - Module documentation update (moduldoku.md) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
122 lines
2.3 KiB
PHP
122 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Safe;
|
|
|
|
use Safe\Exceptions\ZipException;
|
|
|
|
/**
|
|
* @param resource $zip_entry
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_close($zip_entry): void
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_close($zip_entry);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @param resource $zip_entry
|
|
* @return int
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_compressedsize($zip_entry): int
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_compressedsize($zip_entry);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
return $safeResult;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param resource $zip_entry
|
|
* @return string
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_compressionmethod($zip_entry): string
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_compressionmethod($zip_entry);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
return $safeResult;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param resource $zip_entry
|
|
* @return int
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_filesize($zip_entry): int
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_filesize($zip_entry);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
return $safeResult;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param resource $zip_entry
|
|
* @return string
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_name($zip_entry): string
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_name($zip_entry);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
return $safeResult;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param resource $zip_dp
|
|
* @param resource $zip_entry
|
|
* @param string $mode
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_open($zip_dp, $zip_entry, string $mode = "rb"): void
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_open($zip_dp, $zip_entry, $mode);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @param resource $zip_entry
|
|
* @param int $len
|
|
* @return string
|
|
* @throws ZipException
|
|
*
|
|
*/
|
|
function zip_entry_read($zip_entry, int $len = 1024): string
|
|
{
|
|
error_clear_last();
|
|
$safeResult = \zip_entry_read($zip_entry, $len);
|
|
if ($safeResult === false) {
|
|
throw ZipException::createFromPhpError();
|
|
}
|
|
return $safeResult;
|
|
}
|