src/Zip.php
protected function readCentralFileHeader()
    {
        $binary_data = fread($this->fh, 46);
        $header      = unpack(
            'vchkid/vid/vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset',
            $binary_data
        );

        if ($header['filename_len'] != 0) {
            $header['filename'] = fread($this->fh, $header['filename_len']);
        } else {
            $header['filename'] = '';
        }

        if ($header['extra_len'] != 0) {
            $header['extra'] = fread($this->fh, $header['extra_len']);
            $header['extradata'] = $this->parseExtra($header['extra']);
        } else {
            $header['extra'] = '';
            $header['extradata'] = array();
        }

        if ($header['comment_len'] != 0) {
            $header['comment'] = fread($this->fh, $header['comment_len']);
        } else {
            $header['comment'] = '';
        }

        $header['mtime']           = $this->makeUnixTime($header['mdate'], $header['mtime']);
        $header['stored_filename'] = $header['filename'];
        $header['status']          = 'ok';
        if (substr($header['filename'], -1) == '/') {
            $header['external'] = 0x41FF0010;
        }
        $header['folder'] = ($header['external'] == 0x41FF0010 || $header['external'] == 16) ? 1 : 0;

        return $header;
    }
protected function readCentralFileHeader()
    {
        $binary_data = fread($this->fh, 46);
        $header      = unpack(
            'vchkid/vid/vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset',
            $binary_data
        );

        if ($header['filename_len'] != 0) {
            $header['filename'] = fread($this->fh, $header['filename_len']);
        } else {
            $header['filename'] = '';
        }

        if ($header['extra_len'] != 0) {
            $header['extra'] = fread($this->fh, $header['extra_len']);
            $header['extradata'] = $this->parseExtra($header['extra']);
        } else {
            $header['extra'] = '';
            $header['extradata'] = array();
        }

        if ($header['comment_len'] != 0) {
            $header['comment'] = fread($this->fh, $header['comment_len']);
        } else {
            $header['comment'] = '';
        }

        $header['mtime']           = $this->makeUnixTime($header['mdate'], $header['mtime']);
        $header['stored_filename'] = $header['filename'];
        $header['status']          = 'ok';
        if (substr($header['filename'], -1) == '/') {
            $header['external'] = 0x41FF0010;
        }
        $header['folder'] = ($header['external'] == 0x41FF0010 || $header['external'] == 16) ? 1 : 0;

        return $header;
    }
protected function readCentralFileHeader ( ) { $ binary_data = fread ( $ this -> fh , 46 ) ; $ header = unpack ( 'vchkid/vid/vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset' , $ binary_data ) ; if ( $ header [ 'filename_len' ] != 0 ) { $ header [ 'filename' ] = fread ( $ this -> fh , $ header [ 'filename_len' ] ) ; } else { $ header [ 'filename' ] = '' ; } if ( $ header [ 'extra_len' ] != 0 ) { $ header [ 'extra' ] = fread ( $ this -> fh , $ header [ 'extra_len' ] ) ; $ header [ 'extradata' ] = $ this -> parseExtra ( $ header [ 'extra' ] ) ; } else { $ header [ 'extra' ] = '' ; $ header [ 'extradata' ] = array ( ) ; } if ( $ header [ 'comment_len' ] != 0 ) { $ header [ 'comment' ] = fread ( $ this -> fh , $ header [ 'comment_len' ] ) ; } else { $ header [ 'comment' ] = '' ; } $ header [ 'mtime' ] = $ this -> makeUnixTime ( $ header [ 'mdate' ] , $ header [ 'mtime' ] ) ; $ header [ 'stored_filename' ] = $ header [ 'filename' ] ; $ header [ 'status' ] = 'ok' ; if ( substr ( $ header [ 'filename' ] , - 1 ) == '/' ) { $ header [ 'external' ] = 0x41FF0010 ; } $ header [ 'folder' ] = ( $ header [ 'external' ] == 0x41FF0010 || $ header [ 'external' ] == 16 ) ? 1 : 0 ; return $ header ; }
Read the next central file header

Assumes the current file pointer is pointing at the right position

@return array
Read the next central file header