note 126201 added to ziparchive.open
| From: | laacz at laacz dot lv | Date: | Mon, 28 Jun 2021 14:29:33 +0000 |
| Subject: | note 126201 added to ziparchive.open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216556@lists.php.net to get a copy of this message | ||
If on PHP 8.0+, you can use match expression to decode status code:
<?php
$archive = new \ZipArchive();
$result = $archive->open('some.file.zip');
$message = match ($result) {
\ZipArchive::ER_MULTIDISK => 'Multi-disk zip archives not supported',
\ZipArchive::ER_RENAME => 'Renaming temporary file failed',
\ZipArchive::ER_CLOSE => 'Closing zip archive failed',
\ZipArchive::ER_SEEK => 'Seek error',
\ZipArchive::ER_READ => 'Read error',
\ZipArchive::ER_WRITE => 'Write error',
\ZipArchive::ER_CRC => 'CRC error',
\ZipArchive::ER_ZIPCLOSED => 'Containing zip archive was closed',
\ZipArchive::ER_NOENT => 'No such file',
\ZipArchive::ER_EXISTS => 'File already exists',
\ZipArchive::ER_OPEN => 'Can\'t open file',
\ZipArchive::ER_TMPOPEN => 'Failure to create temporary file',
\ZipArchive::ER_ZLIB => 'Zlib error',
\ZipArchive::ER_MEMORY => 'Malloc failure',
\ZipArchive::ER_CHANGED => 'Entry has been changed',
\ZipArchive::ER_COMPNOTSUPP => 'Compression method not supported',
\ZipArchive::ER_EOF => 'Premature EOF',
\ZipArchive::ER_INVAL => 'Invalid argument',
\ZipArchive::ER_NOZIP => 'Not a zip archive',
\ZipArchive::ER_INTERNAL => 'Internal error',
\ZipArchive::ER_INCONS => 'Zip archive inconsistent',
\ZipArchive::ER_REMOVE => 'Can\'t remove file',
\ZipArchive::ER_DELETED => 'Entry has been deleted',
// \ZipArchive::ER_OK => 'No error',
default => 'No error',
};
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 80.89.72.209)
----
Manual Page -- https://php.net/manual/en/ziparchive.open.php
Edit -- https://main.php.net/note/edit/126201
Del: integrated -- https://main.php.net/note/delete/126201/integrated
Del: useless -- https://main.php.net/note/delete/126201/useless
Del: bad code -- https://main.php.net/note/delete/126201/bad+code
Del: spam -- https://main.php.net/note/delete/126201/spam
Del: non-english -- https://main.php.net/note/delete/126201/non-english
Del: in docs -- https://main.php.net/note/delete/126201/in+docs
Del: other reasons-- https://main.php.net/note/delete/126201
Reject -- https://main.php.net/note/reject/126201
Search -- https://main.php.net/manage/user-notes.php