src/Zip.php
protected function readFileHeader($header)
    {
        $binary_data = fread($this->fh, 30);
        $data        = unpack(
            'vchk/vid/vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len',
            $binary_data
        );

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

        $header['compression'] = $data['compression'];
        foreach (array(
                     'size',
                     'compressed_size',
                     'crc'
                 ) as $hd) { // On ODT files, these headers are 0. Keep the previous value.
            if ($data[$hd] != 0) {
                $header[$hd] = $data[$hd];
            }
        }
        $header['flag']  = $data['flag'];
        $header['mtime'] = $this->makeUnixTime($data['mdate'], $data['mtime']);

        $header['stored_filename'] = $header['filename'];
        $header['status']          = "ok";
        $header['folder']          = ($header['external'] == 0x41FF0010 || $header['external'] == 16) ? 1 : 0;
        return $header;
    }
protected function readFileHeader($header)
    {
        $binary_data = fread($this->fh, 30);
        $data        = unpack(
            'vchk/vid/vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len',
            $binary_data
        );

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

        $header['compression'] = $data['compression'];
        foreach (array(
                     'size',
                     'compressed_size',
                     'crc'
                 ) as $hd) { // On ODT files, these headers are 0. Keep the previous value.
            if ($data[$hd] != 0) {
                $header[$hd] = $data[$hd];
            }
        }
        $header['flag']  = $data['flag'];
        $header['mtime'] = $this->makeUnixTime($data['mdate'], $data['mtime']);

        $header['stored_filename'] = $header['filename'];
        $header['status']          = "ok";
        $header['folder']          = ($header['external'] == 0x41FF0010 || $header['external'] == 16) ? 1 : 0;
        return $header;
    }
protected function readFileHeader ( $ header ) { $ binary_data = fread ( $ this -> fh , 30 ) ; $ data = unpack ( 'vchk/vid/vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len' , $ binary_data ) ; $ header [ 'filename' ] = fread ( $ this -> fh , $ data [ 'filename_len' ] ) ; if ( $ data [ 'extra_len' ] != 0 ) { $ header [ 'extra' ] = fread ( $ this -> fh , $ data [ 'extra_len' ] ) ; $ header [ 'extradata' ] = array_merge ( $ header [ 'extradata' ] , $ this -> parseExtra ( $ header [ 'extra' ] ) ) ; } else { $ header [ 'extra' ] = '' ; $ header [ 'extradata' ] = array ( ) ; } $ header [ 'compression' ] = $ data [ 'compression' ] ; foreach ( array ( 'size' , 'compressed_size' , 'crc' ) as $ hd ) { // On ODT files, these headers are 0. Keep the previous value. if ( $ data [ $ hd ] != 0 ) { $ header [ $ hd ] = $ data [ $ hd ] ; } } $ header [ 'flag' ] = $ data [ 'flag' ] ; $ header [ 'mtime' ] = $ this -> makeUnixTime ( $ data [ 'mdate' ] , $ data [ 'mtime' ] ) ; $ header [ 'stored_filename' ] = $ header [ 'filename' ] ; $ header [ 'status' ] = "ok" ; $ header [ 'folder' ] = ( $ header [ 'external' ] == 0x41FF0010 || $ header [ 'external' ] == 16 ) ? 1 : 0 ; return $ header ; }
Reads the local file header

This header precedes each individual file inside the zip file. Assumes the current file pointer is pointing at
the right position already. Enhances the given central header with the data found at the local header.

@param array $header the central file header read previously (see above)
@return array
Reads the local file header