X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Fmime%2FMSCompoundFileReader.php;h=34d612abbd9a72cf67fa8632028ee92c8e687eb9;hp=8afaa38e02cc75d824eab2a606c23a064f2a963d;hb=fa0f6f34972c0e0f4aac24a03b3efdfc45f256f6;hpb=7388b7b62b842ef1e80faa677656a26a90803ece diff --git a/includes/libs/mime/MSCompoundFileReader.php b/includes/libs/mime/MSCompoundFileReader.php index 8afaa38e02..34d612abbd 100644 --- a/includes/libs/mime/MSCompoundFileReader.php +++ b/includes/libs/mime/MSCompoundFileReader.php @@ -149,6 +149,7 @@ class MSCompoundFileReader { $this->error( 'invalid signature: ' . bin2hex( $this->header['header_signature'] ), self::ERROR_INVALID_SIGNATURE ); } + // @phan-suppress-next-line PhanTypeInvalidRightOperandOfIntegerOp $this->sectorLength = 1 << $this->header['sector_shift']; $this->readDifat(); $this->readDirectory(); @@ -177,16 +178,22 @@ class MSCompoundFileReader { ); } + /** + * @param int $offset + * @param int[] $struct + * @return array + */ private function unpackOffset( $offset, $struct ) { $block = $this->readOffset( $offset, array_sum( $struct ) ); return $this->unpack( $block, 0, $struct ); } - private function unpackSector( $sectorNumber, $struct ) { - $offset = $this->sectorOffset( $sectorNumber ); - return $this->unpackOffset( $offset, array_sum( $struct ) ); - } - + /** + * @param string $block + * @param int $offset + * @param int[] $struct + * @return array + */ private function unpack( $block, $offset, $struct ) { $data = []; foreach ( $struct as $key => $length ) { @@ -225,6 +232,7 @@ class MSCompoundFileReader { } private function readSector( $sectorId ) { + // @phan-suppress-next-line PhanTypeInvalidRightOperandOfIntegerOp return $this->readOffset( $this->sectorOffset( $sectorId ), 1 << $this->header['sector_shift'] ); }