note 114158 added to class.ziparchive
| From: | piotr dot stop dot spam at gmail dot com | Date: | Fri, 17 Jan 2014 16:58:39 +0000 |
| Subject: | note 114158 added to class.ziparchive | ||
| Groups: | php.notes php.notes | ||
| Request: | Send a blank email to php-notes+get-198269@lists.php.net to get a copy of this message | ||
You can check general purpose flag to test if the zip file is encrypted. Example function below.
<?php
/**
* Check if the file is encrypted
*
* Notice: if file doesn't exists or cannot be opened, function
* also return false.
*
* @param string $pathToArchive
* @return boolean return true if file is encrypted
*/
function isEncryptedZip( $pathToArchive ) {
$fp = @fopen( $pathToArchive, 'r' );
$encrypted = false;
if ( $fp && fseek( $fp, 6 ) == 0 ) {
$string = fread( $fp, 2 );
if ( false !== $string ) {
$data = unpack("vgeneral", $string);
$encrypted = $data[ 'general' ] & 0x01 ? true : false;
}
fclose( $fp );
}
return $encrypted;
}
----
Server IP: 46.17.113.2
Probable Submitter: 148.81.117.69
----
Manual Page -- http://php.net/manual/en/class.ziparchive.php
Edit -- https://master.php.net/note/edit/114158
Del: integrated -- https://master.php.net/note/delete/114158/integrated
Del: useless -- https://master.php.net/note/delete/114158/useless
Del: bad code -- https://master.php.net/note/delete/114158/bad+code
Del: spam -- https://master.php.net/note/delete/114158/spam
Del: non-english -- https://master.php.net/note/delete/114158/non-english
Del: in docs -- https://master.php.net/note/delete/114158/in+docs
Del: other reasons-- https://master.php.net/note/delete/114158
Reject -- https://master.php.net/note/reject/114158
Search -- https://master.php.net/manage/user-notes.php