diff --git a/composer.json b/composer.json index 16e73ed..d5e6dc6 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ ], "minimum-stability": "stable", "require": { - "php-64bit": "^5.5 || ^7.0" + "php": "^5.5 || ^7.0" }, "autoload": { "psr-4": { diff --git a/src/PhpZip/Model/Entry/ZipAbstractEntry.php b/src/PhpZip/Model/Entry/ZipAbstractEntry.php index 172b116..17f8d24 100644 --- a/src/PhpZip/Model/Entry/ZipAbstractEntry.php +++ b/src/PhpZip/Model/Entry/ZipAbstractEntry.php @@ -1,4 +1,5 @@ <?php + namespace PhpZip\Model\Entry; use PhpZip\Exception\InvalidArgumentException; @@ -257,6 +258,7 @@ abstract class ZipAbstractEntry implements ZipEntry public function setCompressedSize($compressedSize) { if (self::UNKNOWN != $compressedSize) { + $compressedSize = sprintf('%u', $compressedSize); if (0 > $compressedSize || $compressedSize > 0x7fffffffffffffff) { throw new ZipException("Compressed size out of range - " . $this->name); } @@ -285,6 +287,7 @@ abstract class ZipAbstractEntry implements ZipEntry public function setSize($size) { if (self::UNKNOWN != $size) { + $size = sprintf('%u', $size); if (0 > $size || $size > 0x7fffffffffffffff) { throw new ZipException("Uncompressed Size out of range - " . $this->name); } @@ -310,6 +313,7 @@ abstract class ZipAbstractEntry implements ZipEntry */ public function setOffset($offset) { + $offset = sprintf('%u', $offset); if (0 > $offset || $offset > 0x7fffffffffffffff) { throw new ZipException("Offset out of range - " . $this->name); } @@ -523,6 +527,7 @@ abstract class ZipAbstractEntry implements ZipEntry */ public function setDosTime($dosTime) { + $dosTime = sprintf('%u', $dosTime); if (0x00000000 > $dosTime || $dosTime > 0xffffffff) { throw new ZipException('DosTime out of range'); } @@ -554,6 +559,7 @@ abstract class ZipAbstractEntry implements ZipEntry { $known = self::UNKNOWN != $externalAttributes; if ($known) { + $externalAttributes = sprintf('%u', $externalAttributes); if (0x00000000 > $externalAttributes || $externalAttributes > 0xffffffff) { throw new ZipException("external file attributes out of range - " . $this->name); } @@ -847,6 +853,7 @@ abstract class ZipAbstractEntry implements ZipEntry */ public function setCrc($crc) { + $crc = sprintf('%u', $crc); if (0x00000000 > $crc || $crc > 0xffffffff) { throw new ZipException("CRC-32 out of range - " . $this->name); } diff --git a/src/PhpZip/Model/Entry/ZipNewEntry.php b/src/PhpZip/Model/Entry/ZipNewEntry.php index 25d3e00..0fa5b35 100644 --- a/src/PhpZip/Model/Entry/ZipNewEntry.php +++ b/src/PhpZip/Model/Entry/ZipNewEntry.php @@ -258,7 +258,7 @@ abstract class ZipNewEntry extends ZipAbstractEntry } else { fwrite($outputStream, pack('VV', $this->getCompressedSize(), $this->getSize())); } - } elseif ($this->getCompressedSize() !== $compressedSize) { + } elseif ($this->getCompressedSize() != $compressedSize) { throw new ZipException($this->getName() . " (expected compressed entry size of " . $this->getCompressedSize() . " bytes, but is actually " . $compressedSize . " bytes)");