}
/** The file name */
- var $fileName;
+ protected $fileName;
/** The opened file resource */
- var $file;
+ protected $file;
/** The cached length of the file, or null if it has not been loaded yet. */
- var $fileLength;
+ protected $fileLength;
/** A segmented cache of the file contents */
- var $buffer;
+ protected $buffer;
/** The file data callback */
- var $callback;
+ protected $callback;
/** The ZIP64 mode */
- var $zip64 = false;
+ protected $zip64 = false;
/** Stored headers */
- var $eocdr, $eocdr64, $eocdr64Locator;
+ protected $eocdr, $eocdr64, $eocdr64Locator;
- var $data;
+ protected $data;
/** The "extra field" ID for ZIP64 central directory entries */
const ZIP64_EXTRA_HEADER = 0x0001;
);
$structSize = $this->getStructSize( $info );
- $block = $this->getBlock( $this->getFileLength() - $this->eocdr['EOCDR size']
- - $structSize, $structSize );
+ $start = $this->getFileLength() - $this->eocdr['EOCDR size'] - $structSize;
+ $block = $this->getBlock( $start, $structSize );
$this->eocdr64Locator = $data = $this->unpack( $block, $info );
if ( $data['signature'] !== "PK\x06\x07" ) {
$year, $month, $day, $hour, $minute, $second );
// Convert the character set in the file name
- if ( !function_exists( 'iconv' )
- || $this->testBit( $data['general bits'], self::GENERAL_UTF8 )
- ) {
+ if ( $this->testBit( $data['general bits'], self::GENERAL_UTF8 ) ) {
$name = $data['name'];
} else {
$name = iconv( 'CP437', 'UTF-8', $data['name'] );
* If there are not enough bytes in the file to satisfy the request, the
* return value will be truncated. If a request is made for a segment beyond
* the end of the file, an empty string will be returned.
+ *
+ * @param int $segIndex
+ *
* @return string
*/
function getSegment( $segIndex ) {
* Internal exception class. Will be caught by private code.
*/
class ZipDirectoryReaderError extends Exception {
- var $errorCode;
+ protected $errorCode;
function __construct( $code ) {
$this->errorCode = $code;