@@ -48,7 +48,7 @@ class ZipStreamer {
4848 private $ extFileAttrFile ;
4949 private $ extFileAttrDir ;
5050
51- /** @var stream output stream zip file is written to */
51+ /** @var resource $outStream output stream zip file is written to */
5252 private $ outStream ;
5353 /** @var boolean zip64 enabled */
5454 private $ zip64 = True ;
@@ -356,7 +356,7 @@ private function streamFileData($stream, $compress, $level) {
356356 $ compStream = DeflateStream::create ($ level );
357357 }
358358
359- while (!feof ($ stream ) && $ data = fread ($ stream , self ::STREAM_CHUNK_SIZE )) {
359+ while (!feof ($ stream ) && ( $ data = fread ($ stream , self ::STREAM_CHUNK_SIZE )) !== false ) {
360360 $ dataLength ->add (strlen ($ data ));
361361 hash_update ($ hashCtx , $ data );
362362 if (COMPR ::DEFLATE === $ compress ) {
@@ -438,7 +438,7 @@ private function addDataDescriptor($dataLength, $gzLength, $dataCRC32) {
438438
439439 private function buildZip64EndOfCentralDirectoryRecord ($ cdRecLength ) {
440440 $ versionToExtract = $ this ->getVersionToExtract (False );
441- $ cdRecCount = sizeof ($ this ->cdRec );
441+ $ cdRecCount = count ($ this ->cdRec );
442442
443443 return ''
444444 . pack32le (self ::ZIP64_END_OF_CENTRAL_DIRECTORY ) // zip64 end of central dir signature 4 bytes (0x06064b50)
@@ -517,12 +517,12 @@ private function buildCentralDirectoryHeader($filePath, $timestamp, $gpFlags,
517517 private function buildEndOfCentralDirectoryRecord ($ cdRecLength ) {
518518 if ($ this ->zip64 ) {
519519 $ diskNumber = -1 ;
520- $ cdRecCount = min (sizeof ($ this ->cdRec ), 0xffff );
520+ $ cdRecCount = min (count ($ this ->cdRec ), 0xffff );
521521 $ cdRecLength = -1 ;
522522 $ offset = -1 ;
523523 } else {
524524 $ diskNumber = 0 ;
525- $ cdRecCount = sizeof ($ this ->cdRec );
525+ $ cdRecCount = count ($ this ->cdRec );
526526 $ offset = $ this ->offset ->getLoBytes ();
527527 }
528528 //throw new \Exception(sprintf("zip64 %d diskno %d", $this->zip64, $diskNumber));
@@ -646,7 +646,7 @@ protected function __construct($level) {
646646 $ class = self ::PECL2_DEFLATE_STREAM_CLASS ;
647647 }
648648 if (!class_exists ($ class )) {
649- new \Exception ('unable to instantiate PECL deflate stream (requires pecl_http >= 0.10) ' );
649+ throw new \Exception ('unable to instantiate PECL deflate stream (requires pecl_http >= 0.10) ' );
650650 }
651651
652652 $ deflateFlags = constant ($ class . '::TYPE_RAW ' );
@@ -723,8 +723,8 @@ class GPFLAGS {
723723
724724 // compression settings for deflate/deflate64
725725 const DEFL_NORM = 0x0000 ; // normal compression (COMP1 and COMP2 not set)
726- const DEFL_MAX = COMP1 ; // maximum compression
727- const DEFL_FAST = COMP2 ; // fast compression
726+ const DEFL_MAX = self :: COMP1 ; // maximum compression
727+ const DEFL_FAST = self :: COMP2 ; // fast compression
728728 const DEFL_SFAST = 0x0006 ; // superfast compression (COMP1 and COMP2 set)
729729}
730730
0 commit comments